I'll back this request, too. I use -append- to combine my simulated
files, and what I do is I create a -postfile- without actually
-post-ing anything in it, so it comes out with zero observations and
all the variable names needed. Something like that was done by Phil
Schumm & co (am I attributing this right?) a few years back when they
were setting up questionnaires and other survey-related
characteristics of the data in the -notes- section of the file with
zero observations, to be filled up later at actual the data collection
stage. But I do think that -append-ing to the empty data set should be
a reasonable thing to do.
On 11/3/08, Jeph Herrin <[email protected]> wrote:
>
> Sergiy,
>
> I posted this same question two years ago:
>
> http://www.stata.com/statalist/archive/2006-07/msg00097.html
>
> and received no satisfactory response. I often have the
> same problem you have, and proposed that -append- have an
> -empty- option, for instance, so that I can force it to
> use the file if there is nothing in memory. I guess it will
> have to go on a wishlist for StataCorp.
>
> cheers,
> Jeph
>
>
>
> Sergiy Radyakin wrote:
>
> > Dear all,
> >
> > is there any reason for -append- to refuse to run when there is no
> > data in memory?
> >
> > clear
> > append using something.dta
> >
> > I often have a list of files to combine, and go with a simple loop,
> > but when none of them is in memory, I have to brunch the program to
> > specially treat the first file in the list, which is annoying. Since
> > -append- is built-in, I can't look into what it is doing or needing.
> > Otherwise I wish -append- worked as -use- when there is no data in
> > memory. So that the below code could work.
> >
> > local bunch_of_files "alpha beta gamma delta"
> > clear
> > foreach file of local bunch_of_files {
> > append using `"`file'"', nolabel
> > }
> >
> > Notably it is not the observations that -append- requires, but
> > variables, e.g. the following works:
> >
> > local bunch_of_files "alpha beta gamma delta"
> > clear
> > generate byte __STRANGE_VAR_NAME=1 /* still zero observations here */
> > foreach file of local bunch_of_files {
> > append using `"`file'"', nolabel
> > }
> > drop __STRANGE_VAR_NAME
> >
> > Thank you, Sergiy Radyakin
> > *
> > * 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/
>
--
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
* 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/