Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Manipulating strings


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Manipulating strings
Date   Fri, 07 Apr 2006 10:49:09 -0400

help itrim() will show you

replace postcode=trim(itrim(postcode))

Michael Blasnik
michael.blasnik@verizon.net

----- Original Message ----- From: <sdm1@york.ac.uk>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, April 07, 2006 10:24 AM
Subject: st: Manipulating strings



I want to merge two files using a postcode variable. In both the master and
using files postcode is an 8 character string. And in both files the
postcode comprises an outward part (of up to the first four characters),
followed by a blank, followed by an inward element (the remaining three
characters). For example: YO10 5DD, B1 4TH, DR3 5HJ.

The problem is that the outward part is left justified in one file but right
justified (to the blank) in the other. Consequently the merge works for
postcodes - such as 'YO10 5DD' - where the outward part occupies all four
positions (the left and right justification generate the same result) but
does not work where the outward part has less than four characters e.g., for
Y10 5DD which is ' Y10 5DD' in one file but 'Y10 5DD' in the other.

Any suggestions how to overcome this would be most welcome.

Thanks.

Steve
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index