Hello,
I am trying to rescale weights within a single NSFG survey wave to have a mean of 1, however Stata is not returning anything when I use the 'display' command. Stata also says invalid syntax when I attempt to multiply the weight by the new scaling factor, but I can't find anything wrong with it. Is there something small here that is wrong, or am I misunderstanding something about how local macros and scalars work?
summarize finalwgt
return list
local rescalefactor = `r(N)'/`r(sum)'
display `rescalefactor' /// This is the line that returns nothing to me
gen weight2 = .
replace weight2 = finalwgt*`rescalefactor' // Stata error says invalid syntax
summarize weight2
Thank you in advance!
Related Posts with Stata local macros not displaying
"Data have changed" dialog boxI searched the forum for this, but I didn't find anything. Sorry if it's a repeat question. In my w…
Stata returning missing when converting string dateDear all, I have dates in two formats in a single variable one is 20-Apr-19 the other is 21-APRIL-20…
Trouble Generating Variable dependant on periodArray Above is a picture of a subset of my data. hs10 refers to a specific product being sold and m…
Different I-square results for meta summarize and meta forestplot using random empirical Bayes methodHi The meta forestplot using random(ebayes) appears to produce a different value for the I2 result …
meta forestplot error in stata 16Hello I am running several meta forestplots for subgroups which worked fine in the version of stata…
Subscribe to:
Post Comments (Atom)
0 Response to Stata local macros not displaying
Post a Comment