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
Joinpoint RegressionSTATALIST, I want to fit 6 regression models with 0,1,2,3,4,5 joinpoints (knots), but the location …
Create a new variable based on two other variablesHi Statalist. I would like to create a variable (total household assets) based on the values of tot…
Help with Longitudinal SEM - (Missing Means in Output)Hello! I'm having trouble running SEM on longitudinal data (4 waves - (same group followed over tim…
Question about Mixed effect modelDear all. I am looking for wise advice on what happened to my mixed effect model from the STATA expe…
Help create a person ID for panel dataDear Statalisters, I would like to ask for advice regarding creating person ID variables from a hou…
Subscribe to:
Post Comments (Atom)
0 Response to Stata local macros not displaying
Post a Comment