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   Richard Williams <Richard.A.Williams.5@ND.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating/initializing vars without external data file
Date   Sat, 12 Nov 2005 13:12:18 -0500

At 12:01 PM 11/12/2005, George Stimson wrote:
I'm new to Stata and am trying to write a simple routine that uses a
distribution function to create a statistic.

I thought this would be incredibly simple, but I've been unable to
create/initialize a simple set of parameter estimates in the routine
without putting them in a single line raw data file and reading that
file into Stata.

For instance I've tried:
. gen param1=.05
. display param1

and that produces (at least displays) a zero value instead of .05.

Then I tried:
. local param1=.05
. display param1

but that also produces (at least displays) an incorrect result.
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: Richard.A.Williams.5@ND.Edu
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index