Help using Base SAS procedures


Posts: 37



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.
Valued Guide
Posts: 2,167

Re: output

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 ;
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation