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
Alternatives to margins command (too slow)Hi, I have a simple program that estimates that regresses an outcome on (a) event-time dummies (i.e…
Rosenbaum BoundsHi, I have conducted propensity score matching using the WHO-5 Mental Health Index as my outcome va…
Assigning value "1" to a dummy variable when another variable reaches its max, for each individual across choice alternativesI have a dataset of about 3800 observations. This dataset is in long form: I have about 760 individu…
Merging monthly and yearly data for respective last 12monthsHello, I have two data sets which I want to merge. In the first dataset A ,I do have the following …
How to get the significance level stars for the coefficients in thresholdreg cammand for (Hansen, 2000) Threshold Estimation __________________________________________________ ____________________ Thres…
Subscribe to:
Post Comments (Atom)
0 Response to Regarding inclusion of duplicates
Post a Comment