Date: Thu, 6 Dec 2001 10:08:54 -0500
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: Reordering variables in a file output by proc transpose.
Content-Type: text/plain; charset="iso-8859-1"
Ron,
Here is code to indicate the standard method of reordering with an added
twist for your date order.
data w ;
jobname = "xyz" ;
_name_ = "ellapsed" ;
input _011112 _011113 _011116 _011114 _011115 ;
cards ;
1 2 3 4 5
;
proc sql noprint ;
select name into :nmlist separated by " "
from dictionary.columns
where libname = "WORK"
and memname = "W"
and upcase(name) not in ( "JOBNAME" "_NAME_" )
order by input ( substr ( name , 2) , yymmdd. )
;
%put &nmlist ;
run ;
data w ;
retain jobname _name_ &nmlist ;
set w ;
run ;
IanWhitlock@westat.com
-----Original Message-----
From: Carriere, Ron [mailto:rcarriere@MEDNET.UCLA.EDU]
Sent: Wednesday, December 05, 2001 6:31 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Reordering variables in a file output by proc transpose.
The following code
PROC TRANSPOSE DATA=TWO OUT=SOURCE.PRINTEM;
ID SSDATE;
VAR ELAPSED;
BY JOBNAME;
proc print data=source.printem;
Produces
Obs JOBNAME _NAME_ _011112 _011113 _011114 _011115 _011116 _01111
2 LPK#JBC0 ELAPSED 2 . 1 2 . 3
3 LPK#JBC1 ELAPSED 107 . . 220 . 0
4 LPK#JBC2 ELAPSED 643 . . 109 . 1
_011112 ... are dates.
which file is exported to EXCEL via PROC DBLOAD (R. Fehd's suggestion).
This works fine, and I can live with it, but the user of of the excel file
would prefer that the latest dates appear first, i.e. _011117 _011116 and
so on.
How to do this? I don't know how many dates we will be processing in
advance.
Ron Carriere
UCLA Medical Center