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 (October 2009, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 1 Oct 2009 09:58:40 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: How to add a column with order(1,2,3...) like obs in print?
Comments: To: demin <>
In-Reply-To:  <>
Content-Type: text/plain; charset=ISO-8859-1

To me the "best" method is to choose a tool that knows SAS, knows what an SAS enumerated variable list is and how it should most logically be ordered. That tool is PROC CONTENTS.

data q; attrib q12P3R1 Q12P3R10 Q12P3r2 Q12P3R3 length=8; stop; run; proc contents order=ignorecase noprint out=names(keep=name); run; proc print; run;

proc sql noprint; select name into :orderedList separated by ' ' from names; quit; run; %put NOTE: ORDEREDLIST=&orderedList;

On 10/1/09, demin <> wrote: > Because I did something and made the order of my table has been > changed, so I would like to add a order column to keep the old order. > How to add such column with order 1,2,3...? > > Actually the column is character type, like : > Q12P3R1 > Q12P3R10 ? shis should be placed on the last one, but > Q12P3R2 > Q12P3R3 > ... > ?Q12P3R10 should be placed on the last one, but by "proc sql select > *... order by ..." till cannot get the order I want. how to solve > this? thanks. >

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