Hi All
I have a variable birthyear that specifies the year of birth for all subjects in my dataset (any one year between 1981 and 2006). I would like to add the same day and month to the year of birth for all subjects (1st Oct). I need to do this so that I have full date variable (i.e. day, month and year) to be able to calculate for example age etc. My renaming date variables such as date of diagnosis or date of visit have day, month and year.
Currently, birthyear is storage type 'int' with a display format '%8.0g".
1981
1983
1987
1981
1994
2006
2001
1996
What I would like to create is:
1oct1981
1oct1983
1oct1987
1oct1981
1oct1994
I started with generating two variables to specify day and month:
I now have have to add the above bday and bmon to the birthyear variable. I'm not sure how to do this. Any advice most welcome.
Thanks
/Amal
I have a variable birthyear that specifies the year of birth for all subjects in my dataset (any one year between 1981 and 2006). I would like to add the same day and month to the year of birth for all subjects (1st Oct). I need to do this so that I have full date variable (i.e. day, month and year) to be able to calculate for example age etc. My renaming date variables such as date of diagnosis or date of visit have day, month and year.
Currently, birthyear is storage type 'int' with a display format '%8.0g".
:
tab birthyear in 1/8
1983
1987
1981
1994
2006
2001
1996
What I would like to create is:
:
tab birthyear_new in 1/5
1oct1983
1oct1987
1oct1981
1oct1994
I started with generating two variables to specify day and month:
:
gen bd=01 tostring bd, gen(bday) gen bm=10 tostring bm, gen(bmon)
Thanks
/Amal