Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: -save- with emptyok


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: -save- with emptyok
Date   Mon, 12 Feb 2007 17:08:07 -0500

I will use this opportunity to yet again petition the good
folks at Stata to add an "emptyok" option to -append-, so
that -append using [file], emptyok- will simply -use- the
file. It would obviate the various kluges (such as Partha's)
for setting up an intial empty (or other) file to append to.


Partha Deb wrote:
Thanks Nick. I implemented a solution, much like the one you suggest, that does not require emptyok. But it seems to me that emptyok is an "empty" option if variables/observations need to be specified anyway before -save , emptyok- plays nicely with -append- or -merge-. Perhaps this is something for the good folks at Statacorp to chew on.

cheers,

Partha


Nick Cox wrote:

The issue here is not with -save-, but with -append-.
-append- needs something more than almost nothing to join on to. I think you need to -save- your dataset
with variables (even though there are no observations). Fortunately, a token variable is sufficient (but evidently necessary).
. clear
. gen completeanduttergarbage = . . save empty, emptyok . append using auto
. drop completeanduttergarbage
Admittedly, the error message here does not indicate
the problem.
Nick n.j.cox@durham.ac.uk
Partha Deb

I'm having trouble getting -save- to work with emptyok in the way I think it should. Here's an example.

. save temp, emptyok
(note: dataset contains 0 observations)
file temp.dta saved

. use temp.dta

. append using auto.dta
no dataset in use
r(3);


Shouldn't I be able to append? What am I doing wrong? I'm using Stata 9.2.
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index