DATA Step, Macro, Functions and more

Show at the "end",not "first" when proc report and group

Accepted Solution Solved
Reply
Contributor
Posts: 38
Accepted Solution

Show at the "end",not "first" when proc report and group

In the proc report and with group keyword, variable that follow the same value can be  displayed only at the first observation, but is there an option specification that displays "last" instead of "first"?

For example with this SAS official blog,

 

"Canada", "Pacific" of the region subject to the group keyword are displayed on the first line of the group.

Normal group displays Like this.


normal_group.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

proc report data=shoes nowd;
title 'REPORT Default Behavior';
  column region subsidiary product,(sales sales=savg);
 
  define region / group 
         style(column)=Header;
  define subsidiary / group
         style(column)=Header;
  define product / across 'Product Sales';
  define sales / sum 'Sum' f=dollar10.;
  define savg / mean 'Mean' f=dollar10.;
  rbreak after / summarize style=Header;
run;
 

What I want is like this.Look position of Canada and Pacific.

normal_group - コピー.png

Please let me know the option / technique to display like this.


Accepted Solutions
Solution
‎01-22-2018 07:14 AM
SAS Super FREQ
Posts: 9,433

Re: Show at the "end",not "first" when proc report and group

[ Edited ]
Posted in reply to t_ar_taat

Hi:
You need to change the vertical adjustment to "bottom" in order to change the position of the text in the spanning row cell. So you will need to change the VJUST attribute, as shown in this code.
cynthia

 

proc sort data=sashelp.shoes out=shoes;
by region subsidiary product;
where region in ('Canada' 'Pacific') and
      product contains 'Casual';
run;
  
proc report data=shoes nowd spanrows;
title 'VJUST=M';
  column region subsidiary product,(sales sales=savg);
 
  define region / group 
         style(column)=Header{vjust=m};
  define subsidiary / group
         style(column)=Header;
  define product / across 'Product Sales';
  define sales / sum 'Sum' f=dollar10.;
  define savg / mean 'Mean' f=dollar10.;
  rbreak after / summarize style=Header;
run;

proc report data=shoes nowd spanrows;
title 'VJUST=B';
  column region subsidiary product,(sales sales=savg);
 
  define region / group 
         style(column)=Header{vjust=b};
  define subsidiary / group
         style(column)=Header;
  define product / across 'Product Sales';
  define sales / sum 'Sum' f=dollar10.;
  define savg / mean 'Mean' f=dollar10.;
  rbreak after / summarize style=Header;
run;
 
 

View solution in original post


All Replies
Solution
‎01-22-2018 07:14 AM
SAS Super FREQ
Posts: 9,433

Re: Show at the "end",not "first" when proc report and group

[ Edited ]
Posted in reply to t_ar_taat

Hi:
You need to change the vertical adjustment to "bottom" in order to change the position of the text in the spanning row cell. So you will need to change the VJUST attribute, as shown in this code.
cynthia

 

proc sort data=sashelp.shoes out=shoes;
by region subsidiary product;
where region in ('Canada' 'Pacific') and
      product contains 'Casual';
run;
  
proc report data=shoes nowd spanrows;
title 'VJUST=M';
  column region subsidiary product,(sales sales=savg);
 
  define region / group 
         style(column)=Header{vjust=m};
  define subsidiary / group
         style(column)=Header;
  define product / across 'Product Sales';
  define sales / sum 'Sum' f=dollar10.;
  define savg / mean 'Mean' f=dollar10.;
  rbreak after / summarize style=Header;
run;

proc report data=shoes nowd spanrows;
title 'VJUST=B';
  column region subsidiary product,(sales sales=savg);
 
  define region / group 
         style(column)=Header{vjust=b};
  define subsidiary / group
         style(column)=Header;
  define product / across 'Product Sales';
  define sales / sum 'Sum' f=dollar10.;
  define savg / mean 'Mean' f=dollar10.;
  rbreak after / summarize style=Header;
run;
 
 
Contributor
Posts: 38

Re: Show at the "end",not "first" when proc report and group

Posted in reply to Cynthia_sas

Hi,Cynthia

 

Thank you so much !!

It worked very good! 

 

Sincerely,t_ar_taat

group_bottom.png

 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 175 views
  • 0 likes
  • 2 in conversation