Dear Stata Users
I have a string variable yearmonth: for Jan 2004 it's stored as "200401". I need to convert it to a readable year/month format. I have used the following code:
The code above produces strange date variable.
How to alter a code to get a meaningful year/month variable?
Thank you.
I have a string variable yearmonth: for Jan 2004 it's stored as "200401". I need to convert it to a readable year/month format. I have used the following code:
Code:
generate month = date( yearmonth ,"YM") format %tm month
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 yearmonth "200401" "200402" "200403" "200404" "200405" "200406" "200407" "200408" "200409" "200410" "200411" "200412" end
Thank you.
Comment