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 (February 2003, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
 
=========================================================================  
Date:   Tue, 18 Feb 2003 10:56:27 +0100
Reply-To:   Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Jim Groeneveld <J.Groeneveld@ITGROUPS.COM>
Subject:   Re: how to rearrange the columns in SAS record set on an alphabe tica l order?
Comments:   To: "Kurian, Jeomoan T (CAP, ACOE)" <jeomoan.kurian@GECIS.GE.COM>
Content-Type:   text/plain; charset="iso-8859-1"

Hello Jeo,

There are several different solutions; this is one of them. The variables names are automatically determined and alphabetically put into a macro variable, which is used in a RETAIN statement.

data cba; c=1; b=2; a=3; run; proc print data=cba; run; proc contents data=cba out=contents (KEEP=Name) noprint; run; %LET VarList=; data _null_; set contents; call execute ('%LET VarList=&Varlist ' || Name); run; data abc; retain &VarList; set cba; run; proc print data=abc; run;

Regards - Jim. -- Y. (Jim) Groeneveld, MSc IMRO TRAMARKO tel. +31 412 407 070 senior statist./data man. P.O. Box 1 fax. +31 412 407 080 J.Groeneveld@ITGroups.com 5350 AA BERGHEM, NL www.imrotramarko.com

IF Annoying=T THEN Salutation=''; ELSE IF Sex='M' THEN Salutation='Hi'; ELSE IF Sex='F' THEN Salutation='Dear'; ELSE /* unknown, more, all */ Salutation='Hallo';

Notice of confidentiality: this e-mail may contain confidential information intended for the addressed recipient only. If you have received this e-mail in error please delete this e-mail and please notify the sender so that proper delivery can be arranged.

> -----Original Message----- > From: Kurian, Jeomoan T (CAP, ACOE) > [mailto:jeomoan.kurian@GECIS.GE.COM] > Sent: 18 February 2003 10:27 > To: SAS-L@LISTSERV.UGA.EDU > Subject: how to rearrange the columns in SAS record set on an > alphabetica l order? > > > SAS-L, > > I deal with a record set which has 330 plus columns and not > listed in any > particular order. It would be easier for me to do a walk > through id the > columns are arranged in alphabetical order. I tried 'retain' > before set > <recordset> and its ok for smaller datasets. When every time I have > different variables this becomes very difficult.. > Please let me know any tips ? > > thanks in advance, > Jeo > > > > This e-mail, together with any attachments, is > confidential. It may be read, copied and used only by the intended > recipient. If you have received it in error, please notify the sender > immediately by e-mail or telephone. Please then delete it from your > computer without making any copies or disclosing it to any > other person.Any > unauthorised copying, disclosure or distribution of the > material in this


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