I am cleaning a large dataset & now need to make some manual changes to a string variable so that it is in the correct format to split & reshape.
I want to build a local in the format <new>|<old> and use gettoken to separate the local & then run the replace command. Some of the strings are very long & so I have changed the delimiter in order to split over rows. An extract of the do file code for the local is as follows (there are many more strings to be changed):
Code:
* syntax convention: `" <new>|<old> <new>|<old> [...] "' #delimit ; local change `" "Pre-registration, USA, Europe.|Pre-registration, USA and Europe." "Marketed, UK. Phase III, USA.|Marketed, UK, Phase III, USA." "Registered, UK. Pre-registration, Worldwide.|Registered, UK; Pre-registration, Worldwide." "' ; #delimit cr
Alternatively, I can add to the local in each line using local change `" `change' "new text|old text" "' , but I would prefer the first method for readability of the do file. I am working on a PC in Stata/MP 14.2.
Thank you for any help you can provide.
Best wishes,
Bryony
0 Response to local with semi-colon using #delimit
Post a Comment