Dear all,
I have two variables and iI want to keep just the year of each.
(1) a long variables mdate of type "28mar1996". How can I keep just "1996"?
(2) a float variable fdate of type "1996m3".
Could anyone of you please guide so that I generate a new variable "year" where I have just 1996?
My attemp was: gen str4 year = substr(string(mdate), 1, 4) --> however here what I get instead of 1996 is 434.
Thank you in advance for any piece of advice!
I have two variables and iI want to keep just the year of each.
(1) a long variables mdate of type "28mar1996". How can I keep just "1996"?
(2) a float variable fdate of type "1996m3".
Could anyone of you please guide so that I generate a new variable "year" where I have just 1996?
My attemp was: gen str4 year = substr(string(mdate), 1, 4) --> however here what I get instead of 1996 is 434.
Thank you in advance for any piece of advice!
Comment