f



Re: Read a variable from Right to Left #2

...many questions left, about what you REALLY want...
If it's so simple like "substr from right to left" I'd suggest something like

reverse(substr(left(reverse(string)),1,9)



On Tue, 21 Mar 2006 16:31:09 -0800, David L Cassell <davidlcassell@MSN.COM>
wrote:

>gsingh24@GMAIL.COM wrote:
>>I want help to substring a variable from right to left, for eg: I have
>>a SAS data set which has a variable Address like.
>>
>>Address
>>
>>114, Mills Rd, Apt 202
>>345 Morris Drive, Apt 345
>>Chestnut Avenue Apt # 987
>>
>>Is there a way I can create a variable say Type like
>>
>>Type
>>
>>Apt202
>>Apt345
>>pt#987
>
>Is there *always* an apartment number?
>
>Is 'apartment' *always* abbreviated 'Apt' ?
>
>Is the number always numeric?  No occurrences of 'Apartment 3-G'
>or 'Apt B-12' or 'Aptmt R' ?
>
>Is a six-character string *really* going to be adequate?  What about
>'Apt 3407' or 'Apt B-347' ?
>
>Do you really want to keep that '#' in your third example?  What other
>non-numerics show up that you would want to drop?
>
>
>Write back to SAS-L and give more detail.  This is a non-trivial task,
>and for maximum flexibility I would recommend using the PRX()
>functions to parse the text string.  But I'll hold off on more details
>until you can supply them.
>
>HTH,
>David
>--
>David L. Cassell
>mathematical statistician
>Design Pathways
>3115 NW Norwood Pl.
>Corvallis OR 97330
>
>_________________________________________________________________
>Don�t just search. Find. Check out the new MSN Search!
>http://search.msn.click-url.com/go/onm00200636ave/direct/01/
0
ghellrieg (838)
3/22/2006 2:37:37 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
380 Views

Similar Articles

[PageSpeed] 48

Reply: