Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Creating/initializing vars without external data file


From   "George Stimson" <[email protected]>
To   [email protected]
Subject   Re: st: Creating/initializing vars without external data file
Date   Sat, 12 Nov 2005 16:09:32 -0600

Michael,

The -set obs 1 - command was just what I needed.

Many thanks to both you and Richard Williams for helping me understand
this.  My do file is now working just as I had expected.

George

----------------------
Michael Blasnick wrote:

It sounds like you want to stick with local macros for such a
calculation, since I can't see the reason to have a dataset for your
task. You do not need to open a dataset to use local macros or to use
-generate-. However, without an open dataset you can must use -set obs-
prior to -generate-, otherwise -generate- will not generate anything if
there are no observations.

Michael Blasnik
[email protected]

----- Original Message ----- From: "George Stimson" <[email protected]>
To: <[email protected]>
Sent: Saturday, November 12, 2005 3:17 PM
Subject: Re: st: Creating/initializing vars without external data file

Richard,

Thanks for your very helpful response.

I'm using Stata 9.1 Intercooled for Windows and am trying to transition
from SAS, SYSTAT and SPSS (ugh).

Your response solved my problem to a point.  I was not familiar with the
"webuse" command and was beginning my do file with a "gen" command
without having any data file open.  Apparently in that case (but I'm not
sure), the "gen" and "local" commands do not initialize variables.

I can add the "webuse auto" command, but I'm wondering if it is possible
instead to have webuse open a null or temp data file.  I would prefer
not to have my display cluttered by reference to an irrelevant data file
(like "1978 Automobile Data") if that is possible.

All I'm doing is a simple procedure that makes a distributional
calculation on a single set of one-case parameters to produce an
immediate statistic.  I had hoped that routine could be accomplished
without having to open a data file.  If not, at least you have given me
an option that does not require me to actually create a one-line
external data set and call it at the beginning of the do file.

So, do you know if it is possible to call a null or temp data file
instead of a real data set?

Again, many thanks.

George

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index