Hi, I am having problem in generating a new variable. So, I want to generate a variable from a date variable which has duplicate dates but their case id are different and I need all numbers.
I tried with the commands mentioned below:
1) gen cv_date_twelve=.
replace cv_date_twelve=1 if cv_date3 !=. | cv_date6 !=. | cv_date9 !=. | cv_date12 !=.
replace cv_date_twelve=0 if cv_date_twelve==.
tab cv_date_twelve
2)gen cv_date_twelve=.
replace cv_date_twelve=cv_date3 if cv_date3 !=.
replace cv_date_twelve=cv_date6 if cv_date6 !=.
replace cv_date_twelve=cv_date9 if cv_date9 !=.
replace cv_date_twelve=cv_date12 if cv_date12 !=.
replace cv_date_twelve=0 if cv_date_twelve==.
tab cv_date_twelve
Kindly help.
Regards,
Harpreet
Related Posts with Regarding inclusion of duplicates
How to balance an unbalanced panel on the year variable?Hello everyone! I am fairly new to Stata and am unable to solve (perhaps) very basic problems. I am…
xtabond2Hello everyone, I am currently working with dynamic panel data. The model I want to estimate using …
Multilevel model (binary outcome) with spatial weight matrix (not panel data)Hi Stata forum users, Does stata have any option to incorporate a spatial weight matrix with melogi…
Fractional logit model for proportions over timeDear all, I have calculated a “Diversity Index” for a given population. Per the census website, the …
Fractional logit model for proportions over timeDear all, I have calculated a “Diversity Index” for a given population. Per the census website, the …
Subscribe to:
Post Comments (Atom)
0 Response to Regarding inclusion of duplicates
Post a Comment