BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NeilGiles
Calcite | Level 5

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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;

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

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;

 

NeilGiles
Calcite | Level 5

Legend .... Thanks Chris, that's perfect

 

 

... I don't know why, but it won't let me like your post, but consider it liked 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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