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
Confidence interval for crude rateI would like to calculate the 95% confidence interval for the crude rate. How I could do it in STATA…
Multiple bars in a single chartHi all, I have very basic question that I cannot find an answer to. I have tried all sorts of option…
Test statistics and p-values different in SEM linear regression vs. OLSGreetings, I'm running Stata 15.1 on a Mac OS. I'm currently working with aggregate time series dat…
Creating observation pairs in Stata - balanced sample, no replacementHello, I am trying to create a balanced sample of paired observations in Stata based on a treated a…
Correct date variableHi all, I hope someone can help here. I want to correct the first two digits of the year from a dat…
Subscribe to:
Post Comments (Atom)
0 Response to Create a var with some conditions in a same column
Post a Comment