Hello everyone, I'm now stuck into this one:
I have a data-set and a (sample) weight variable. Due to the sample design I have to weight for all my procedures.
Now I have to generate a new variable (v1) based on a condition using other two variables in the data-set, this new variable being used later in some analysis (logistic regression etc):
gen byte v1 = 0
replace v1=1 if days >300&days< 500 & condition ==1
v1 is byte, days is continuous (number of days), condition is categorical, with 5 levels (0, 1, 2, 3, 4)
However, gen egen / replace doesn't accept weights and declaring survey is not working since svy: doesn't work with gen egen.
Generating v1 from unweighted days and condition doesn't seem right.
Is there a way around? Or something more general like "weight cases" in SPSS (turning weight on/off)? Or am I missing something?
Thank you!
Cristian
Related Posts with create a new variable from weighted variables?
Marginsplot legend labeling with plotoptsDear all, I'm want to plot an an interaction effect, with labels in the legend. Thus, I'm using thi…
How to resolve xtlogit issue with interaction?Hi I am new to Stata and the Forum and I also encounter issue with xtlogit. Appreciate any help: I r…
Rename variables within loop - ambiguous abbreviation errorHello, I have biannual files called "job_history" with a year suffix at the end (job_history_1992, j…
Kalman Filter and VARMADears i have 3 variables being time, index and stock I would like to estimate a Kalman Filter for st…
Multilevel models with complex survey designHi, I was hoping that someone at Statalist could help me with this. I’m trying to use multilevel log…
Subscribe to:
Post Comments (Atom)
0 Response to create a new variable from weighted variables?
Post a Comment