LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 13 Aug 2008 10:47:43 -0400
Reply-To:   Jack Clark <jclark@HILLTOP.UMBC.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jack Clark <jclark@HILLTOP.UMBC.EDU>
Subject:   Re: Create table with 10 first variables
Comments:   To: ash007 <RamsamyAshley@GMAIL.COM>
In-Reply-To:   A<b31d7bf5-68e5-442d-a049-71e97ea3d2a4@z72g2000hsb.googlegroups.com>
Content-Type:   text/plain; charset="us-ascii"

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.


Back to: Top of message | Previous page | Main SAS-L page