Hi,
I want to create a var with some conditions in a same column. For example,
This is the original data
Id var1
01 c
01 d
02 m
02 f
I want to create a var (var2) =1, if i have "c" and "d" in my Id "01"
Id var1 var2
01 c 1
01 d 1
02 m .
02 f
Kind Regards,
S.
Related Posts with Create a var with some conditions in a same column
How to check for significant heterogeneity for a categorical variable with 2 interactionsDear Statlist, I am estimating whether elderly age in a healthier way because of the Long-term care…
How to do Reality check and SPA test by Stata?Dear Statalist, I want to know whether there are any user written commands by stata for performing …
Regression on Panel DataHello, I am having a bit of trouble running the xtreg command on my dataset. I have panel data on 2…
Question about diff-in-diff with multiple control groups and one treatment groupHello! I am running a Difference in Difference (DD) regression to see whether the introduction of a…
Parametric survival analysis Good morning. I am doing parametric survival analysis through streg. After streg, I got the followi…
Subscribe to:
Post Comments (Atom)
0 Response to Create a var with some conditions in a same column
Post a Comment