Hallo Christoph
At the end of each rounds, save the new variables together with a unique identification variable, and then restore.
After restore, you can merge in the saved variables.
Rerards
Kim
Kim Lyngby Mikkelsen
Seniorforsker
Arbejdsulykker og Sikkerhed
Det Nationale Forskningscenter for Arbejdsmiljø
-----Oprindelig meddelelse-----
Fra: [email protected] [mailto:[email protected]] På vegne af Stata Chris
Sendt: 25. juni 2009 16:00
Til: [email protected]
Emne: st: How to restore dataset after preserve, but keep some specific variables?
Good morning,
I need to do similar calculations, generating a new variable, on
different subsamples of my dataset,
and was therefore planning to use the preserve command each time
before cutting the dataset,
and then, after having generated the respective variable, restore to
return to the full dataset.
The problem with this is that once I restore the data, my new variable
is gone as well.
I first thought I could store this in a local macro,
but when I wanted to summarize all macros at the end of the dofile, it
turned out Stata wanted to use the lost variable, having apparently
remembered only that the macro consisted of said variable, but not the
distribution of the variable itself.
So my question is: How can I after each of these rounds generally
return to the full dataset,
but keep the one new variable?
Many thanks and best regards,
Christoph
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/