Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: question about local and var[n]


From   "G. Dai" <dgecon@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: question about local and var[n]
Date   Mon, 24 Oct 2011 23:47:11 -0600

Dear all,
I have one question about the use of local macros.
For example, assume the date

ID     ny_price
ny      5
wa      4

set obs 2
gen str ID=""
replace ID="ny" in 1
replace ID="wa" in 2
gen ny_price=4
replace ny_price=5 in 1


Then My question comes from the following differences:


. local city ny

.
. replace `city'_price=100 in 1
(1 real change made)


However,

. local city ID[1]
. di `city'
ny
. replace `city'_price=100 in 1
weights not allowed
r(101);

Why?
thanks!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index