I'm looking to extract the last four digits of a date formated as 07apr2021 to create a new variable, so right now i'm using
gen year=substr(fiscal_year_ended,-4,.)
which I think would work if I had only numerical/string values, but with a combination of both I'm for sure confusing the system. So I have since tried
gen year= (substr(string(fiscal_year_ended),-4,.)) but now I'm getting numbers that are not even prevalent in my data set. Advice?
gen year=substr(fiscal_year_ended,-4,.)
which I think would work if I had only numerical/string values, but with a combination of both I'm for sure confusing the system. So I have since tried
gen year= (substr(string(fiscal_year_ended),-4,.)) but now I'm getting numbers that are not even prevalent in my data set. Advice?
Comment