|
Ash007,
You could query the dictionary.columns table for the first data set and
load a macro variable with the names of the first ten variables in the
data set. Then, use the macro variable in a KEEP= data set option to
create the new data set.
* create dummy data ;
data have;
retain var1-var20 'ABC';
array var(20) var1-var20;
do i = 1 to 10;
output;
end;
run;
proc print data = have;
run;
proc sql noprint;
select name
into :topten separated by ' '
from dictionary.columns
where libname = 'WORK' and
memname = 'HAVE' and
varnum le 10
;
quit;
%put &topten;
data need;
set have (keep=&topten);
run;
proc print data = need;
run;
Jack Clark
Research Analyst
phone: 410-455-6256
fax: 410-455-6850
jclark@hilltop.umbc.edu
University of Maryland, Baltimore County
Sondheim Hall, 3rd Floor
1000 Hilltop Circle
Baltimore, MD 21250
Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
ash007
Sent: Wednesday, August 13, 2008 10:31 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Create table with 10 first variables
Hello,
how can we create a dataset with the 10 first variables of an another
dataset without specify the name of the 10 variables.
thanks.
ash007.
|