Hello
I have a %tc variable (PERIOD_END) for date:
There are numerous possibilities for the date, but in each case the year makes up characters 6-9 of the variable. I tried to extract only these characters using the following code:
That only assigned the characters "D_EN" to a variable called year. I also unsuccessfully tried the regexm command:
[code]gen year=2014 if regexm("PERIOD_END", "2014") == 1
[/code
I have a feeling I'm supposed to use the regexm command, but that I am using it incorrectly. Thanks.
I have a %tc variable (PERIOD_END) for date:
Code:
31mar2014 00:00:00 28feb2014 00:00:00
Code:
gen year = substr("PERIOD_END",6,9)
[code]gen year=2014 if regexm("PERIOD_END", "2014") == 1
[/code
I have a feeling I'm supposed to use the regexm command, but that I am using it incorrectly. Thanks.
Comment