Hi,
I have the following dates:
I would like to extract the year and month. I have tried the code:
which return the following because of the way my variable "date" is stored in Stata:
Can someone help me with that? Thank!
I have the following dates:
HTML Code:
date 1972q2 1972q3 1972q4 1973q1 1973q2 1973q3 1973q4 1974q1 1974q2
Code:
gen year = year(date) gen month = month(date)
HTML Code:
date year month 1972q2 1960 2 1972q3 1960 2 1972q4 1960 2 1973q1 1960 2 1973q2 1960 2 1973q3 1960 2 1973q4 1960 2 1974q1 1960 2 1974q2 1960 2
Comment