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 <>
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

. local param1 = .05

. display `param1'

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

. display param1[1]

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):
WWW (department):
* For searches and help try:

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