Daniel M�ller
>
> I have a string variable, which looks like "12 34 56 78".
> How can I remove
> the blanks to obtain "12345678" ? I guess it can be done with -gen
> x=subinstr(s1,s2,s3,n), but I do not get the syntax
> correct. I checked the
> archives and the FAQs without success.
Stata < 8
=========
gen str8 x = subinstr(s1," ","",.)
This takes your example literally. More general is
gen str1 x = ""
replace x = subinstr(s1," ","",.)
Stata 8
=======
The "str8" is optional.
gen x = subinstr(s1," ","",.)
Nick
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/