Announcement

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

  • Append when Using dataset has 'extra' variables

    I am using Stata for Windows 13.1 and have a basic question about appending two datasets where the master dataset has fewer variables than the using dataset.

    When I export the resulting dataset to a .csv file and open the .csv in Excel, I find that all the 'unmatched' variables from the using dataset are in the last columns of the spreadsheet -- not in the order of the using data.

    Does this suggest a problem with my append? Is there a way to have the variable order of the output and using datasets be the same?

  • #2
    Originally posted by Vito Di Bona View Post
    Does this suggest a problem with my append?
    No, that's the way append works.

    Originally posted by Vito Di Bona View Post
    Is there a way to have the variable order of the output and using datasets be the same?
    The easiest option would be to start with the second dataset in memory and then append the first to it, using sort to reorder the observations, if necessary. Alternatively, you could use
    append using myfile
    qui des using myfile, varlist
    order `r(varlist)'

    Comment

    Working...
    X