| Date: | Mon, 5 Feb 1996 00:13:14 GMT |
| Reply-To: | Aswin Bouwmeester <A.Bouwmeester@INTER.NL.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> |
| From: | Aswin Bouwmeester <A.Bouwmeester@INTER.NL.NET> |
| Organization: | Inter.NL.net, The Internet Provider in The Netherlands. |
| Subject: | Re: Subsetting SAS Dataset with SCL Lists |
|---|
Chris Roper <ROPER%VTVM1.BITNET@VTBIT.CC.VT.EDU> wrote:
>Dear SASL-ers,
>I've been scratching my head on this one and I am sure someone out there has
>faced a similar problem, and I'm hoping they would share their solution.
>The problem: SAS 6.11, FRAME application,
>I've got an SCL list of names, which can vary in size, that I want to use to
>subset a SAS dataset, such that if the SCL list contains the names 'CHARLIE'
>'BOB' and 'LISA', I want to retrieve the observations from the SAS dataset
>which contain those names.
>I've tried using SCL arrays, and haven't had much luck, especially since SCL
>doesn't support implicit arrays(remember the list length varies and I don't
>know ahead of time how large the list will be).
>Any help on this snowbound day would be greatly appreciated!
>Chris Roper
>Sr. Programmer/Analyst
>Lotus Biochemical Corp.
>croper@giv.com
The solution to your problem is to create a WHERE clause using the SCL
list. In the following example a datastep is used to show this:
SUBMIT;
DATA target;
SET source(WHERE=(varname IN(
ENDSUBMIT;
DO item=1 TO LISTLEN(list);
word=QUOTE(GETITEMC(list,item));
IF item>1 THEN woord=', '|| word;
SUBMIT;
&word
ENDSUBMIT;
END;
SUBMIT CONTINUE;
)));
RUN;
ENDSUBMIT;
Hope this is what you needed,
Aswin
A.Bouwmeester@inter.NL.net
|