You are not logged in. You can browse but not post. Login or Register by clicking 'Login or Register' at the top-right of this page. For more information on Statalist, see the FAQ.
I have a variable "date" which consists of dates in the format _dd_mm_yyyy. I want it to be formatted as dates in proper dd-mm-yyyy . How can I edit the underscores?
clear
input str11 date
"_01_01_2000"
"_02_01_2000"
"_03_01_2000"
end
gen date2 = date(date,"DMY")
format date2 %td
gen date3 = substr(date,2,.)
replace date3 = subinstr(date3,"_","-",.)
Comment