Quantcast

st: deleting spaces in a string file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

st: deleting spaces in a string file

Sharooon
I have a string file with entries such as:

" davis"
"davis"
"davis "
" davis "

which stata is recognizing as different values, what I'd like to do is trim the spaces and have them all appear as

"davis"

How can I do that?


     

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st: deleting spaces in a string file

Richard Goldstein

use the trim function; type -help trim- to learn about it

Sharooon wrote:

> I have a string file with entries such as:
>
> " davis"
> "davis"
> "davis "
> " davis "
>
> which stata is recognizing as different values, what I'd like to do is trim the spaces and have them all appear as
>
> "davis"
>
> How can I do that?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: st: deleting spaces in a string file

nshephard
Administrator
On Mon, Jun 22, 2009 at 7:31 PM, Richard
Goldstein<[hidden email]> wrote:
>
> use the trim function; type -help trim- to learn about it
>

Or more generally the -subinstr()- command, both are explained under
the help for string functions (type -man strfun-).

Neil

--
"The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data." ~ John Tukey (1986), "Sunset salvo". The American
Statistician 40(1).

Email - [hidden email]
Website - http://slack.ser.man.ac.uk/
Photos - http://www.flickr.com/photos/slackline/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Loading...