| Date: | Wed, 22 Mar 2006 21:38:55 -0800 |
| Reply-To: | jato <jato88@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | jato <jato88@GMAIL.COM> |
| Organization: | http://groups.google.com |
| Subject: | Re: Read a variable from Right to Left |
|
| In-Reply-To: | <1142981639.138970.269620@t31g2000cwb.googlegroups.com> |
| Content-Type: | text/plain; charset="iso-8859-1" |
|---|
If the variable seperated by comma, then you can try the below:
data add;
input address $30.;
apartment=scan(address,-1,',');
cards;
114,Mills Rd,Apt 202
345,Morris Drive,Apt 345
678,Chestnut Avenue,Apt# 987
;
run;
proc print;
run;
Richie wrote:
> Hi All,
>
> 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
>
> Thanks,
> Richie
|