Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • exporting variables and their values to excel from Stata

    Dear experts in the Statalist,
    I am working with a data in Stata. I have generated new variables ( which are technically my outputs) which have the same values for all observations.

    Code:
    
    gen CC`x' = elas2016_`x'*(CI2016_`x' - CI2011_`x') + CI2011_`x'*(elas2016_`x' - elas2011_`x')
    gen che_CI`x' = elas2016_`x'*(CI2016_`x' - CI2011_`x') 
    gen che_Ela`x' = CI2011_`x'*(elas2016_`x' - elas2011_`x')
    The CC`x', che_CI`x' and che_ElaC`x' are newly generated variables (outputs) that I would like to export to word or excel in the form of tables. The `x' in these variables indicate that they are created
    for all my variables ( education, wealth, residence etc). For example, education has 2 categories (no, primary) and all of these 3 categories have outputs from all of the three outputs/ the generated variables). For example, the following shows the output for the 2 categories of education and this same applies for all of my variables:

    Code:
    CC`x'noeducation  che_CI`x'noeducation che_Ela`x'noeducation CC`x'primary che_CI`x'primary   che_Ela`x' primary
    0.8               0.678                         0.45                               0.78                0.04                   -0.009

    These newly created variables(outputs) have values that are the same for all observation. How does I export this output into table in word or excel from Stata.

    Thank you in advance for your help.

  • #2
    If you want to export the data "as is" to Excel, see

    Code:
    help export excel
    With tables, there is some structure and you will need some work to achieve a desired format. There are plenty of examples, however, if you search the forum.

    Comment


    • #3
      Code:
      export excel
      does not appear to support if or in but you could export and then delete all but the first observations.

      In a way, this is all backward as a natural way to export a set of scalars might be through use of putexcel.

      Dare I mention copy and paste? I wouldn't use it for anything intended ultimately for publication, but I might use it otherwise.

      Comment


      • #4
        Thank you both. I will try these methods. After I export it to the excel this way may cost me additional time to get them in the form of a publication ready table.
        Regards,

        Comment

        Working...
        X