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
Welch's F-test as an alternative to Fisher's F.Hi Everyone, Is there an option to get Welch's F or Brown-Forsythe's F in Stata (for situations whe…
twoway histogram gen with 0 frequencyHi! I have a question regarding the twoway histogram gen, which is a subroutine for histogram in St…
dsregress displays undefined error when Estimating lasso for variables of interestI am currently running a series of lasso regressions and I encountered an error that I cannot identi…
How to combine descriptive statistics and ttest resultsArray Hello; I have three dependent variable and all of them are binary, and a list of independent …
Stata Probit Model Interaction Term InterpretationHello everyone, for my thesis i am currently investigating the effects of emissions on health on a …
Subscribe to:
Post Comments (Atom)
0 Response to Stata local macros not displaying
Post a Comment