04-04-2017 08:30 AM
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;
04-04-2017 09:31 AM
04-04-2017 01:24 PM
04-04-2017 01:40 PM
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.
04-04-2017 11:33 PM
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.
04-06-2017 02:30 PM
04-06-2017 07:53 PM