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

This is my first post here. I would like to create mutiple tables by using proc tabulate. I have 20 different names in the variable called 'group', and would like to create 20 tables for each of the group. I could restrict each group in WHERE statement within proc tabulate. But rather than write my codes 20 times, I'm wondering if there is a way to put macro in there. Appreciate any suggestions.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Use the BY variable processing with ODS TAGSETS.EXCELXP - it will create each tab for you by default.

http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#data

View solution in original post

4 REPLIES 4
Astounding
PROC Star

You have a couple of relatively simple choices (no macro language needed).

 

(1) Sort your data by this GROUP variable, and run a single PROC TABULATE adding the statement BY GROUP;

(2) If your table is two-dimensional, add a third dimension which would be GROUP.  For this to be the paging dimension of the table, it has to appear first:

 

tables GROUP, (row dimension), (column dimension);

 

Good luck.

dlin
Calcite | Level 5

Thank you so much! It provides me a new approach, but I kinda would like to gerenerate 20 tables seperately, because I'd like to export each table into one spreadsheet within one big excel workbook.

Reeza
Super User
Use the BY variable processing with ODS TAGSETS.EXCELXP - it will create each tab for you by default.

http://support.sas.com/rnd/base/ods/odsmarkup/excelxp_demo.html#data
dlin
Calcite | Level 5

Thank you! very helpful!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 1760 views
  • 3 likes
  • 3 in conversation