BookmarkSubscribeRSS Feed
mick_g
Calcite | Level 5
data:

age_group date enrolled aid
senior 1/5/2011 y y
teen 1/5/2011 y y
child 1/5/2011 y y
infant 1/5/2011 y y
mature 1/5/2011 y n
senior 1/10/2011 y n
teen 1/10/2011 y n

Above is sample data. I need to create an document prefer excel that will first give the sum of each age group and then the total. Second I need to have detail pages for each age group.

I started with a simple proc freq statement but it did not give me the totals. How do I get a total?

For the detail pages in excel should I do a marco or an array. Or is there a much easier way. I know I can do it in proc report but the data needs to be manipulated by the end user which means end user preferes excel.

I also have to put a logo on the top of the report before the title.
1 REPLY 1
Peter_C
Rhodochrosite | Level 12
have you considered proc sort, proc tabulate, followed by proc print, using class/by statement something like :
ods tagsets.excelxp file= '!temp\demo.xml' ;
proc sort data= your_data out= _data_ ;
by age_group ;
run ;
%let ordered = &syslast ;
ods tagsets.excelxp options( sheet_name='summary' ) ;
proc tabulate data= &ordered missing format= 5. ;
class age_group ;
var date ;
table age_group all, n date=' '*( min='from' max='to')*f= mmddyy. ;
run ;
ods tagsets.excelxp options( sheet_name='detail_' ) ;
proc print data= &ordered label noobs ;
by age_group ;
pageby age_group ;
run ;
ods tagsets.excelxp close ;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 880 views
  • 0 likes
  • 2 in conversation