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
Multilevel binomial logistic regression model with three levels does not convergeDear Statalist users, I am trying to fit a multilevel logistic regression model with a three-level …
Poisson Regression with Hausman Taylor instrumental variables estimatorI have a panel data. The dependent variable is a count variable, so a Poisson regression is more app…
Update Stata code for retrieving COVID data?I've greatly enjoyed running Chuck Huber's Stata code that automated the download of COVID data from…
replace the value of variableHi, I am new to Stata. In my case, I have a variable equal to 1, 2,3,4,5 and my task is to make the …
ARDL and estimating a shock for dummyDear all, I am trying to estimate the effect of an observed trade shock (the entrance of China in W…
Subscribe to:
Post Comments (Atom)
0 Response to Stata local macros not displaying
Post a Comment