Sorry, you have not really told us anything there. A good question is one that provides test data, in the form of a datastep (or from sashelp tables), and what the output should look like. Also, any code you have done towards it or logic needed.
From what I can decode from your post you are talking about two different things. By group processing does the whole procedure for each by group, define/group sums just block out and summarise data within the one procedure. Now for by group something like:
ods tagsets.excelxp file="s:\temp\rob\test.xml" options(sheet_interval="bygroup"); proc sort data=sashelp.class out=class; by sex; run; proc report data=class; by sex; title '#byval1'; run; ods tagsets.excelxp close;
Sorry, the question is not clear. Proc report is just a more advanced version of proc print. Wether you use one or the other is up to you. Me, I use proc report for all output. By grouping works on both those, and in fact almost all procedures.
Hi:
Well, PROC REPORT or PROC PRINT doesn't matter, what matters is the options and suboptions you use. For example, this code works fine for me to name each sheet with the value of the BY group for that sheet.
proc sort data=sashelp.class out=class;
by age;
where age in (12, 13, 14);
run;
options nobyline;
ods excel file='c:\temp\bygrp_excel_sheet_title.xlsx' style=htmlblue
options(sheet_interval='bygroup' sheet_name="Age: #byval1" embedded_titles='yes');
ods tagsets.excelxp file="c:\temp\bygroup_one_sheet_title.xml" style=htmlblue
options(sheet_interval='bygroup' sheet_name="Age: #byval1" embedded_titles='yes');
proc report data=class;
by age;
column name sex age height weight;
title 'Report for Age: #byval(age)';
run;
ods tagsets.excelxp close;
ods excel close;
Since you did not really provide data nor information about the destination you were using, I just used SASHELP.CLASS and ODS EXCEL and ODS TAGSETS.EXCELXP as proof of concept. You will at least need 9.4 of SAS to run the ODS EXCEL example, but the TAGSETS.EXCELXP example should work in 9.3 as well.
cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.