Date: Tue, 18 Jun 1996 22:13:09 -0600
Reply-To: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Andrew James Llwellyn Cary <ajlcary@IX.NETCOM.COM>
Organization: Cary Consulting Services
Subject: Re: A question on proc sql.
> I have a clinical data set with 79 observations on some 100
> variables. From this 79 by 100 data set, I want to select 50
> variables out, and form a new sub-data set. One way to do this is to
> use a proc sql as follows;
> proc sql;
> create table new as
> select (list of 50 variables)
> from (data set name);
> I am wondering if there is a simpler way to select the 50 variables
> in proc sql, instead of listing each single one of them.
> Suppose the 50 variables' names have a sequential number attached
> to them,
> e.g. the names of the 50 variables could be "x1,x2,x3,....,x52, x53".
> I have tried to use "select x1-x53" in the proc sql, it does not work.
Here's a cheap trick.
Define a macro called list to build your list.
%DO I=&START %TO %eval(&STOP-1);
and use it in your SQL;
SELECT %BUILDCDL(Y,50,75) FROM test;
Andrew J. L. Cary | I Reckon that the Opinions
Senior Curmudgeon | expressed here DO represent
Cary Consulting Services, Newark, CA | those of the management of
firstname.lastname@example.org | Cary Consulting Services