Date: Thu, 19 Mar 1998 16:02:21 -0800
Reply-To: nmurray@qldnet.com.au
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Nya Alison Murray <nmurray@QLDNET.COM.AU>
Subject: Re: Urgent! Parse certain values in an SCL variable
Content-Type: text/plain; charset=us-ascii
Hi Ramesh
This code puts the values of the states in an scl list.
init:
listid=makelist();
test='and state in("CA" "PA" "NC" "NE")';
test=tranwrd(test,'and state in(','');
test=tranwrd(test,')','');
test=translate(test,'','"');
do until(test='');
test=trim(left(test));
item=substr(test,1,2);
rc=insertc(listid,item,-1);
test=tranwrd(test,item,'');
end;
call putlist(listid);
return;
Ramesh Krishnamurthy wrote:
> Hi SAS-lr's
>
> I have and SCL variable that I pull out of a list and it looks like this:
> test=and state in("CA" "PA" "NC" "NE"....)
>
> Here's what I want out of this SCL variable:
> I want to be able to parse this variable and extract CA PA NC NE.
>
> Any help suggestions would be appreciated.
>
> Thanks
> Ramesh
|