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 14:17:28 -0600

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

--------------
Richard Williams wrote earlier:

What version of Stata? Here is what I get using 9.1:

. webuse auto
(1978 Automobile Data)

. gen param1 = .05

. display param1
.05

. local param1 = .05

. display `param1'
.05

Notice the left & right single quote marks for the local macro. Also,
note that the first display is equivalent to

. display param1[1]
.05

i.e. when you give only a var name to display, it prints out the value
of the first case.


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc 
*
*   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