Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: question about local and var[n]


From   "G. Dai" <[email protected]>
To   statalist <[email protected]>
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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index