Why is it you need to do a transpose? Couldn't you just select from the data dictionary, and put an order by the variable number?
ods output variables=variables;
proc contents data=work.have;
run;
proc sql noprint;
select trim(variable) :middlevars
separated by ' '
from variables
where trim(variable) not in ('CUST_NUM','TOTAL')
order by num;
quit;
%put middlevars=&middlevars;
proc print data = HAVE noobs label;
var CUST_NUM;
var &middlevars;
var TOTAL;
run;
-Mary
--- iebupdte@GMAIL.COM wrote:
From: "Data _null_;" <iebupdte@GMAIL.COM>
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: Retain statement and value at the END???
Date: Fri, 8 Jan 2010 13:33:00 -0600
This is how I was thinking about the problem, but Ya's solution is
much simplier. I suppose there could be a reason to use a technique
like this if you don't want to create more copies of the data. I was
also thinking from your second post about how everything was
productionized and generalized that you already had a list of variable
names like the one I call MIDDLEVARS.
DATA HAVE;
INPUT CUST_NUM CUST_RANK TOTAL
JAN09 FEB09 MAR09 Q109 APR09 MAY09 JUN09 Q209;
CARDS;
12345 1 950 100 200 100 400 150 200 200 550
14569 2 825 100 150 100 350 100 200 175 475
;
RUN;
proc transpose data=have(obs=0 drop=cust_: total) out=mq;
var _all_;
run;
proc sql noprint;
select _name_ into :middleVars separated by ' '
from mq;
quit;
%put NOTE: MIDDLEVARS=&middleVars;
/*ods tagsets.newhtml file="&outlib./REPORT_BY_QTR.xls" ;*/
proc print data = HAVE noobs label;
var cust_:;
var &middlevars;
var Total;
run;
/*title1 "Detail Sales Report";*/
/*ods tagsets.newhtml close;*/
On 1/8/10, Norman Weston <nweston@amgen.com> wrote:
> Thanks all. That worked. I set another value equal to total and it
> established it at the end of the row. YEAH!!! My boss' will be happy
> they have their report in their order.
>
> Thanks again for the help.
>
|
|
0
|
|
|
|
Reply
|
mlhoward (1825)
|
1/8/2010 8:55:04 PM |
|