DATA Step, Macro, Functions and more

how can i sort the computed Total_count variable as descending order in proc report

Reply
Occasional Contributor
Posts: 5

how can i sort the computed Total_count variable as descending order in proc report

PROC REPORT DATA=expo.OPEN_TICKET_SUMMARY_SOURCE1 out=expo.summary_table_result LIST
/*style=[cellwidth=.1 in rules=group frame=void] */
style(header)=[background= #BBDEFB foreground=black]
style(summary)=[background=white foreground=black font_weight=bold];


COLUMN UserName (category,status) Total_count ;
DEFINE UserName / GROUP style=[background=#BBDEFB foreground=black font_weight=bold borderleftwidth=2 borderrightwidth=2] ;
DEFINE CATEGORY / ACROSS style =[borderleftwidth=1 borderrightwidth=1];
DEFINE STATUS / ACROSS style =[borderleftwidth=1 borderrightwidth=1 ];
define total_count / computed style=[font_weight=bold foreground=black ] ;
rbreak after / summarize;
compute total_count;
Total_count=sum(input(_c2_,best32.),
input(_c3_,best32.),
input(_c4_,best32.),
input(_c5_,best32.),
input(_c6_,best32.),
input(_c7_,best32.),
input(_c8_,best32.),
input(_c9_,best32.),
input(_c10_,best32.)
);

IF total_count ^= ''
THEN CALL DEFINE(_COL_, "style", "STYLE=[BACKGROUND=white ]");
endcomp;

RUN;

Super User
Super User
Posts: 9,441

Re: how can i sort the computed Total_count variable as descending order in proc report

Why not summarise your data in a a datastep before the proce report using a procedure designed for such a task - means/summary - then use a simple proc report to print the data out.  You have full control over the data then.

Super User
Posts: 13,358

Re: how can i sort the computed Total_count variable as descending order in proc report

As I understand proc report you can only modify the order of appearance of variables that are Group, Order or Across, not computed.

 

So to get the desired order I think you'll want to go with @RW9's suggestion of summarizing the data prior to building the report.

Occasional Contributor
Posts: 5

Re: how can i sort the computed Total_count variable as descending order in proc report

Thanks,
@ballardw i have solved above issue by using datafmt option
Ask a Question
Discussion stats
  • 3 replies
  • 103 views
  • 0 likes
  • 3 in conversation