Hi everyone,
Please I need your help to extract only the years from a date variable stored as double. For instance, a date appears in cells as 26.12.16 but stored as 26dec2016 00:00:00. Another is 01.01.17 (01jan2017 00:00:00).
After extracting the years and putting them into a new variable (Year_1), I want to generate another variable, Year_2, and replace it to 2016 if Year_1==2016. Then use similar approach for 2017, i.e. replace Year_2= 2017 if Year_1==2017
I use Stata 14. Kindly walk me through the require steps. Thank you for your assistance.
Please I need your help to extract only the years from a date variable stored as double. For instance, a date appears in cells as 26.12.16 but stored as 26dec2016 00:00:00. Another is 01.01.17 (01jan2017 00:00:00).
After extracting the years and putting them into a new variable (Year_1), I want to generate another variable, Year_2, and replace it to 2016 if Year_1==2016. Then use similar approach for 2017, i.e. replace Year_2= 2017 if Year_1==2017
I use Stata 14. Kindly walk me through the require steps. Thank you for your assistance.

Comment