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]

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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