Desktop productivity for business analysts and programmers

proc tabulate two-way table vertical

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

proc tabulate two-way table vertical

Hi All,

 

I'm looking for a way to create output using proc tabulate two-way table vertically.

 

Please find Sample.xlsx attached.

 

Regards,

Thokozani


Accepted Solutions
Solution
‎03-09-2016 05:36 AM
SAS Super FREQ
Posts: 806

Re: proc tabulate two-way table vertical

Posted in reply to Thokozani

Hi

 

Using the task Summary Tables you can create something like this. The layout definition would look like

Capture.PNG

It is using sashelp.cars.

 

And here a code example generated by SAS Enterprise Guide

 

PROC TABULATE
  DATA=SASHELP.CARS
  FORMAT=NLNUM14.
;
  WHERE( Origin IN ('Asia','Europe'));
  VAR Invoice;
  CLASS Type /  ORDER=UNFORMATTED MISSING;
  CLASS Origin /  ORDER=UNFORMATTED MISSING;
  CLASS DriveTrain /  ORDER=UNFORMATTED MISSING;

  TABLE /* Row Dimension */
    Type={LABEL=""} 
      ALL={LABEL="Total (ALL)"},
      /* Column Dimension */
    Origin={LABEL=""}*(
      DriveTrain={LABEL=""}*
      Invoice={LABEL=""}*
      Sum={LABEL=""} 
      ALL={LABEL="Total (ALL)"}*
      Invoice={LABEL=""}*
      Sum={LABEL=""});
    ;
RUN;

 

Bruno

 

 

 


Capture.PNG

View solution in original post


All Replies
Solution
‎03-09-2016 05:36 AM
SAS Super FREQ
Posts: 806

Re: proc tabulate two-way table vertical

Posted in reply to Thokozani

Hi

 

Using the task Summary Tables you can create something like this. The layout definition would look like

Capture.PNG

It is using sashelp.cars.

 

And here a code example generated by SAS Enterprise Guide

 

PROC TABULATE
  DATA=SASHELP.CARS
  FORMAT=NLNUM14.
;
  WHERE( Origin IN ('Asia','Europe'));
  VAR Invoice;
  CLASS Type /  ORDER=UNFORMATTED MISSING;
  CLASS Origin /  ORDER=UNFORMATTED MISSING;
  CLASS DriveTrain /  ORDER=UNFORMATTED MISSING;

  TABLE /* Row Dimension */
    Type={LABEL=""} 
      ALL={LABEL="Total (ALL)"},
      /* Column Dimension */
    Origin={LABEL=""}*(
      DriveTrain={LABEL=""}*
      Invoice={LABEL=""}*
      Sum={LABEL=""} 
      ALL={LABEL="Total (ALL)"}*
      Invoice={LABEL=""}*
      Sum={LABEL=""});
    ;
RUN;

 

Bruno

 

 

 


Capture.PNG
Super User
Posts: 10,615

Re: proc tabulate two-way table vertical

Posted in reply to Thokozani

You can't split these two table completely .

 

data have;
 set sashelp.cars;
 retain dummy ' ' x .;
run;

proc tabulate data=have;
class Type Origin DriveTrain ;
class dummy /missing style={background=yellow cellwidth=1cm};
classlev dummy /style={background=yellow};
var Invoice x;
table Type all,Origin*Invoice*(n mean std) 
      dummy=''*x=''*sum=''*{style={background=yellow}}
      DriveTrain*Invoice*(n mean std)
      /printmiss misstext='  ';
run;

 

x.png

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 510 views
  • 2 likes
  • 3 in conversation