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
about tupleshow to use the option conditionals to realize that var1 var2 var3 appear together or disappear toget…
Storage type of a new variable. clear all . set obs 1 . gen var=20190417 // today's date in a custom format . format var %10.0g //…
How can I view/show previously entered commands from a saved .dta file when operating in new Stata window?I am having trouble location & showing the commands I had entered in a saved .dta file when I op…
VAR model with population weightsDear all, I am about to re-estimate a VAR model from a published paper with 23 countries over 30 ye…
collinearity when partitioning the whole sample into sub-groupHi guys! my basic model contains age term (age-40) to quatic of age term and corresponding interacti…
Subscribe to:
Post Comments (Atom)
0 Response to Create a var with some conditions in a same column
Post a Comment