Statalist The Stata Listserver

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

st: Manipulating strings

From   [email protected]
To   <[email protected]>
Subject   st: Manipulating strings
Date   Fri, 7 Apr 2006 15:24:37 +0100

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.



*   For searches and help try:

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