Hello Statalist,
I imported an excel dataset that had a timestamp variable (de_date), and Stata seems to have read it as a date variable: the type is double and the format is %tcnn/dd/ccYY_hh:MM. I am trying to extract the year and month, but all that results in is blank observations. I'm sure I'm missing an easy yet crucial step.
my code:
gen de_month = month(de_date)
gen de_year = year(de_date)
Thanks in advance for your help.
I imported an excel dataset that had a timestamp variable (de_date), and Stata seems to have read it as a date variable: the type is double and the format is %tcnn/dd/ccYY_hh:MM. I am trying to extract the year and month, but all that results in is blank observations. I'm sure I'm missing an easy yet crucial step.
my code:
gen de_month = month(de_date)
gen de_year = year(de_date)
Thanks in advance for your help.
Comment