Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Triming labels.


From   "David Harrison" <[email protected]>
To   <[email protected]>
Subject   st: RE: Triming labels.
Date   Fri, 12 Nov 2004 16:20:39 -0000

-trim()- only removes leading and trailing blanks. To remove embedded blanks you will need to use something like -subinstr()-.

Are you talking about variable labels or value labels? If variable labels, then something along the lines of

foreach v of varlist _all {
	label var `v' "`=subinstr("`: var lab `v''"," ","",.)'"
}

should remove all embedded blanks from all variable labels (which may be a little overkill!) - to limit to certain variables change the -_all- to the varlist you want changed.

Something along similar lines ought to work for value labels.

David
[email protected]

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: 12 November 2004 16:10
To: [email protected]
Subject: st: Triming labels.


Hi,

How to remove blanks in labels (for example : "Region\ South" to
"Region\South")?
I am trying trim but it is not working.
Best regards.
Amadou.

*
*   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/



*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index