I've read the paper here
http://support.sas.com/resources/papers/proceedings11/087-2011.pdf
on how to create classes so that you can force PROC TABULATE to print columns and rows that have zero-totals.
The paper shows an example of setting up a class using this code:
DATA CLASS;
DO SVC=’A’,’F’,’N’,’M’;
DO PG=’E’,’O’;
OUTPUT;
END;
END;
RUN;
My question is: is it possible to have this class created dynamically using two single-column tables, one containing the possible values of SVC, the other containing the possible values of PG. These two tables with values of SVC and PG could be generated at run time from the data using PROC SORT on the main data table to get a list of unique values of each variable.
I am working in an area where things change at a million miles an hour, and it would be nice if the tables produced in monthly reporting used classes that were automatically updated within the program at run-time, rather than having to be hard-coded each time there is a change.
Any help appreciated and thanks in advance. I have googled to try and find a paper or anything on this, but so far no leads.
Like this?
proc sql;
create table CLASSDATA as
select SVC, PG
from TAB_SVC,TAB_PG;
quit;
or even this:
proc sql;
create table CLASSDATA as
select SVC, PG
from (select unique SVC from MAINTABLE)
,(select unique PG from MAINTABLE);
quit;
Like this?
proc sql;
create table CLASSDATA as
select SVC, PG
from TAB_SVC,TAB_PG;
quit;
or even this:
proc sql;
create table CLASSDATA as
select SVC, PG
from (select unique SVC from MAINTABLE)
,(select unique PG from MAINTABLE);
quit;
Legend .... Thanks Chris, that's perfect
... I don't know why, but it won't let me like your post, but consider it liked
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.