BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Is there a way of creating an excel workbook for each change in the value of the by variable in proc report?

Any help would be much appreciated.

Thanks
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
You could investigate the NEWFILE= option, which works with most Markup destinations.

With this code, I get 1 file for each by group: msrep1.xls thru msrep10.xls for the MSOFFICE2K HTML files and xprep1.xls thru xprep10.xls for the TAGSETS.EXCELXP XML files (using SASHELP.SHOES).

cynthia

[pre]
ods msoffice2k file='c:\temp\msrep1.xls' style=sasweb newfile=bygroup;
ods tagsets.excelxp file='c:\temp\xprep1.xls' style=sasweb newfile=bygroup;

proc report data=sashelp.shoes nowd;
title 'Report for #byval(region)';
by region;
column region product sales;
define region /group;
define product /group;
define sales /sum;
rbreak after / summarize;
run;

ods _all_ close;
[/pre]

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore 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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 921 views
  • 0 likes
  • 2 in conversation