Sunday, March 12, 2006

st: how to avoid truncation when trimming a long string

colleagues -- i want to trim leading a trailing blanks off a string entered by a user in a program -- the string is saved in local macro "model". the string may be very long (longer than 256 characters).

when i use the following line:

local model = trim("`model'")

this works fine as long as `model' is shorter than 256 characters. when longer, stata truncates the string (i think at 256 characters). is there an easy way to trim leading and trailing blanks from a long string? (i'm travelling, so don't have access to my manuals right now -- so apologies if there's a ready answer in the manuals. i couldn't find anything on the statalist archives).

thanks, sean.

_____________________________ sean f. reardon associate professor of education and (by courtesy) sociology school of education, CERAS building 520 galvez mall, #526 stanford university stanford, ca 94305-3084 650.736.8517 (office phone) 650.723.9931 (office fax) sean.reardon@stanford.edu _____________________________

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


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?