%let Vector=Cars+Real_Estate+Shops+Factories;
%let k=4;
%macro tabulate;
%Do j=1 %TO &k.;
%let sector=%SCAN(&vector.,&j.,+);
Title;
Title "§or.";
proc tabulate data=Rawtbl (Where=(sector=§or.));
class day_loan month_loan;
VAR sum_loan;
table day_loan='',sum_loan=''*(Sum='sum of loans in $')*month_loan='month'/box='day';
Run;
%end;
%mend;
%tabulate;
You can combine by and class to produce several reports in one run:
proc sort
data=sashep.cars
out=cars
;
by origin;
run;
proc tabulate data=cars;
class make;
by origin;
var msrp;
table make*msrp;
run;
You can combine by and class to produce several reports in one run:
proc sort
data=sashep.cars
out=cars
;
by origin;
run;
proc tabulate data=cars;
class make;
by origin;
var msrp;
table make*msrp;
run;
Or use one or more Class variables to create a "Page" level, then you get one table per level of the Page expression:
proc tabulate data=sashelp.cars; class make; class origin; var msrp; table origin, /* <= Page*/ make*msrp, /* <= Row */ sum /* <= Column */ ; run;
And Proc Tabulate will allow multiple TABLE statements in a single proc call.
proc tabulate data=sashelp.cars; class make; class origin; class type; var msrp; table origin, /* <= Page*/ make*msrp, /* <= Row */ sum /* <= Column */ ; table origin, /* <= Page*/ make*msrp, /* <= Row */ type *mean /* <= Column */ ; run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.