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

st: RE: Triming labels.

From   "David Harrison" <>
To   <>
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.


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


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

*   For searches and help try:

*   For searches and help try:

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