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
Importing/Reformatting Data by IDHi Everyone, I'm trying to merge about a dozen different lists that use the same ID scheme but are …
r(608) error in loopHi! I'm trying to create groups in my data: for every year and district I create a group that inclu…
how to custom plot axis with different scaling?Is there any option with Stata that can achieve the same goal as this in R: labels = function(y) {pa…
Comparing IV Coefficients for Two GroupsHi, I am trying to determine whether there is a statistically significant difference between a singl…
Stata is turning out results very slowly. What can i do?I have a dataset comprising about 30 million observations. When i try to execute even basic commands…
Subscribe to:
Post Comments (Atom)
0 Response to Stata local macros not displaying
Post a Comment