<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: proc report in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4152#M1320</link>
    <description>Hi:&lt;BR /&gt;
  There are several different ways to do the report. If I had to pick between PROC REPORT and DATA step program, I guess I'd pick a DATA step program, because it allows me to set counting variables AND produce the report with one pass through the data. Even in PROC REPORT you have to set up counting variables to make this kind of report work, with so many summary lines after the detail section.&lt;BR /&gt;
 &lt;BR /&gt;
  So, using SASHELP.CLASS, I can produce this report with a DATA step program.&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data Step Detail Report With Summary Info&lt;BR /&gt;
&lt;BR /&gt;
             Name                 Gender    Height    Age&lt;BR /&gt;
&lt;BR /&gt;
Alfred                            M           69.0     14&lt;BR /&gt;
Alice                             F           56.5     13&lt;BR /&gt;
Barbara                           F           65.3     13&lt;BR /&gt;
Carol                             F           62.8     14&lt;BR /&gt;
Henry                             M           63.5     14&lt;BR /&gt;
James                             M           57.3     12&lt;BR /&gt;
Jane                              F           59.8     12&lt;BR /&gt;
Janet                             F           62.5     15&lt;BR /&gt;
Jeffrey                           M           62.5     13&lt;BR /&gt;
John                              M           59.0     12&lt;BR /&gt;
Joyce                             F           51.3     11&lt;BR /&gt;
Judy                              F           64.3     14&lt;BR /&gt;
Louise                            F           56.3     12&lt;BR /&gt;
Mary                              F           66.5     15&lt;BR /&gt;
Philip                            M           72.0     16&lt;BR /&gt;
Robert                            M           64.8     12&lt;BR /&gt;
Ronald                            M           67.0     15&lt;BR /&gt;
Thomas                            M           57.5     11&lt;BR /&gt;
William                           M           66.5     15&lt;BR /&gt;
Total Females:   9&lt;BR /&gt;
Total Males:  10&lt;BR /&gt;
Tall Students:  12&lt;BR /&gt;
Short Students:   7&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The program used to generate this output is shown at the bottom of this post.&lt;BR /&gt;
&lt;BR /&gt;
For help with the programming logic of the program or for help tailoring the program to your data, your best bet is to contact Tech Support. You will need to use BY group processing and FIRST.byvar or LAST.byvar in order to correctly generate the report BY DEPARTMENT, for example.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
   &lt;BR /&gt;
ods html file='c:\temp\detail_with_summary_data.html' style=egdefault;&lt;BR /&gt;
  title 'Data Step Detail Report With Summary Info';&lt;BR /&gt;
  title2 ' ';&lt;BR /&gt;
  options missing = ' ' nodate nonumber;&lt;BR /&gt;
   &lt;BR /&gt;
  ** start the programming environment to calculate the counters;&lt;BR /&gt;
  ** that I want to show;&lt;BR /&gt;
  data _null_;&lt;BR /&gt;
    ** reset the length of Name so it can hold the summary line;&lt;BR /&gt;
    length Name $30;&lt;BR /&gt;
    set sashelp.class end=no_more_data;&lt;BR /&gt;
    ** retain counters;&lt;BR /&gt;
    retain fcnt mcnt tcnt scnt 0;&lt;BR /&gt;
    ** increment counters for each record;&lt;BR /&gt;
    if sex = 'M' then mcnt + 1;&lt;BR /&gt;
      else if sex = 'F' then fcnt + 1;&lt;BR /&gt;
    if height ge 60 then tcnt + 1;&lt;BR /&gt;
      else if height lt 60 then scnt + 1;&lt;BR /&gt;
    ** start sending the report to ODS;&lt;BR /&gt;
    file print ods=(variables=(name sex height age));&lt;BR /&gt;
    ** write the 4 columns listed in the variables= option;&lt;BR /&gt;
    ** This will write out EVERY data row.;&lt;BR /&gt;
    put _ods_;&lt;BR /&gt;
    if no_more_data then do;&lt;BR /&gt;
       ** at the end of the file "reset" the value for name;&lt;BR /&gt;
       ** so it holds the summary line info;&lt;BR /&gt;
       ** then write out the name to column 1;&lt;BR /&gt;
       ** Note, Name field had to be bigger than the "old" name field;&lt;BR /&gt;
       ** to hold the string that I wanted for the summary line.;&lt;BR /&gt;
       name = 'Total Females: '|| put(fcnt,3.0);&lt;BR /&gt;
       put @1 name ;&lt;BR /&gt;
       name = 'Total Males: '|| put(mcnt,3.0);&lt;BR /&gt;
       put @1 name  ;&lt;BR /&gt;
       name = 'Tall Students: '|| put(tcnt,3.0); &lt;BR /&gt;
       put @1  name;&lt;BR /&gt;
       name = 'Short Students: '|| put(scnt,3.0);&lt;BR /&gt;
       put @1 name ;&lt;BR /&gt;
    end;&lt;BR /&gt;
    format age 3.0 height 6.1 sex $6.;&lt;BR /&gt;
    label sex = 'Gender';&lt;BR /&gt;
  run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
    <pubDate>Mon, 13 Aug 2007 19:10:53 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2007-08-13T19:10:53Z</dc:date>
    <item>
      <title>proc report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4149#M1317</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
My report is about Full-time employees,  need how many females, males and ethnic background, and  total for department.   I am doing Proc report to do.&lt;BR /&gt;
&lt;BR /&gt;
PROC REPORT data = sfile1 spacing = 1 style(Header)={font_size=2.0 font_weight=medium} split='*' missing;&lt;BR /&gt;
       column  Department Gender N   PRIMARY_ETHNICITY  PRIMARY_ETHNICITY_DESC ;&lt;BR /&gt;
                   &lt;BR /&gt;
       define Department /group "DEPARTMENT" ;&lt;BR /&gt;
      define Gender /group "GENDER" ;&lt;BR /&gt;
      define PRIMARY_ETHNICITY_DESC  /group "ETHNICITY" ;&lt;BR /&gt;
      define PRIMARY_ETHNICITY / noprint;&lt;BR /&gt;
break after Gender / summarize;&lt;BR /&gt;
  compute after gender;&lt;BR /&gt;
   	if gender = 'F' then&lt;BR /&gt;
	  line "Total Females "  N;&lt;BR /&gt;
	&lt;BR /&gt;
               if gender ='M' then&lt;BR /&gt;
                 line "Total Males " N; &lt;BR /&gt;
  endcomp;&lt;BR /&gt;
  break after PRIMARY_ETHNICITY  / summarize;&lt;BR /&gt;
  compute after PRIMARY_ETHNICITY ;&lt;BR /&gt;
	if PRIMARY_ETHNICITY = '1' and Gender = 'F' then&lt;BR /&gt;
	  line "Total Female Whites "  N;&lt;BR /&gt;
	if PRIMARY_ETHNICITY ='2' and Gender = 'F' then&lt;BR /&gt;
                     line "Total Female Blacks " N; &lt;BR /&gt;
	if PRIMARY_ETHNICITY ='3' and Gender = 'F' then&lt;BR /&gt;
                    line "Total Female Hispanics " N; &lt;BR /&gt;
  endcomp;&lt;BR /&gt;
&lt;BR /&gt;
break after department / summarize;&lt;BR /&gt;
  compute after department;&lt;BR /&gt;
    department="Total In "||Department;&lt;BR /&gt;
	line "total emp: "  N;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
break after department /summarize;&lt;BR /&gt;
Rbreak after / summarize;&lt;BR /&gt;
  compute after;&lt;BR /&gt;
    line "Total : " N;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
	 &lt;BR /&gt;
&lt;BR /&gt;
Please give me suggestions&lt;BR /&gt;
&lt;BR /&gt;
I like to get the output  as follows:&lt;BR /&gt;
&lt;BR /&gt;
department    Gender     Ethnicity&lt;BR /&gt;
CHEM             F              White&lt;BR /&gt;
                      F               Black&lt;BR /&gt;
                      F               Hispanic&lt;BR /&gt;
 Total Females    3&lt;BR /&gt;
Total   Whites      1&lt;BR /&gt;
Total  Blacks        1&lt;BR /&gt;
Totla  Hispanic     1 &lt;BR /&gt;
same for Males also&lt;BR /&gt;
&lt;BR /&gt;
Thank you</description>
      <pubDate>Fri, 10 Aug 2007 18:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4149#M1317</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-10T18:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: proc report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4150#M1318</link>
      <description>Hi:&lt;BR /&gt;
  I am confused by what you want to do. It seems to me from your final example, that you want a DETAIL report with summary information at the bottom of the detail report. The report you want is is not what you would get with your PROC REPORT code.  And, by now, you have discovered, the N statistic is not working the way you envision. I find it useful sometimes to step back and define what I'm about to explain -- what I mean by DETAIL and SUMMARY reports.&lt;BR /&gt;
 &lt;BR /&gt;
SAS is capable of producing both DETAIL and SUMMARY reports:&lt;BR /&gt;
--DETAIL reports are reports which show one row on the finished report for EVERY observation in the data set (or subset) that I am using as input for the report.&lt;BR /&gt;
--DETAIL reports CAN have summary lines -- subtotal and/or grandtotals and how you get the subtotals or grandtotals will depend on the procedure or technique you use to product the detail report.&lt;BR /&gt;
--If I write a simple DETAIL report using SASHELP.CLASS -- then I will have 19 rows on the report that come from data -- because there are 19 records or observations in SASHELP.CLASS.&lt;BR /&gt;
--SASHELP.CLASS doesn't lend itself to having subtotals or grandtotals, but let's suppose that I wanted to add up everybody's weight to see how heavy the students were -- I could add a subtotal line that would appear at the break between genders -- so I would know how much all the boys weighed and how much all the girls weighed. I could also add a grandtotal line that would appear at the bottom of the report to show how much all the students weighed. This is such a detail report:&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC PRINT DETAIL REPORT&lt;BR /&gt;
  &lt;BR /&gt;
Sex    Name       Age    Height    Weight&lt;BR /&gt;
  &lt;BR /&gt;
 F     Alice       13     56.5       84.0&lt;BR /&gt;
       Barbara     13     65.3       98.0&lt;BR /&gt;
       Carol       14     62.8      102.5&lt;BR /&gt;
       Jane        12     59.8       84.5&lt;BR /&gt;
       Janet       15     62.5      112.5&lt;BR /&gt;
       Joyce       11     51.3       50.5&lt;BR /&gt;
       Judy        14     64.3       90.0&lt;BR /&gt;
       Louise      12     56.3       77.0&lt;BR /&gt;
       Mary        15     66.5      112.0&lt;BR /&gt;
---                                ------&lt;BR /&gt;
 F                                  811.0&lt;BR /&gt;
       &lt;BR /&gt;
 M     Alfred      14     69.0      112.5&lt;BR /&gt;
       Henry       14     63.5      102.5&lt;BR /&gt;
       James       12     57.3       83.0&lt;BR /&gt;
       Jeffrey     13     62.5       84.0&lt;BR /&gt;
       John        12     59.0       99.5&lt;BR /&gt;
       Philip      16     72.0      150.0&lt;BR /&gt;
       Robert      12     64.8      128.0&lt;BR /&gt;
       Ronald      15     67.0      133.0&lt;BR /&gt;
       Thomas      11     57.5       85.0&lt;BR /&gt;
       William     15     66.5      112.0&lt;BR /&gt;
---                                ------&lt;BR /&gt;
 M                                 1089.5&lt;BR /&gt;
                                   ======&lt;BR /&gt;
                                   1900.5&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
You can see that I have 1 report row for every student, plus there is added subtotal information and the final 1900.5 is the total weight of all the students.&lt;BR /&gt;
The above DETAIL report with subtotals and grandtotals was produced with PROC PRINT. PROC PRINT only produces DETAIL reports -- where you have 1 report row for every observation in your dataset. PROC REPORT and the DATA step also produce detail reports. An example of the above report produced with PROC REPORT is shown below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC REPORT DETAIL REPORT&lt;BR /&gt;
&lt;BR /&gt;
                                             N&lt;BR /&gt;
  Gender        Name         Weight      Count&lt;BR /&gt;
  Females       Alice            84          1&lt;BR /&gt;
                Barbara          98          1&lt;BR /&gt;
                Carol         102.5          1&lt;BR /&gt;
                Jane           84.5          1&lt;BR /&gt;
                Janet         112.5          1&lt;BR /&gt;
                Joyce          50.5          1&lt;BR /&gt;
                Judy             90          1&lt;BR /&gt;
                Louise           77          1&lt;BR /&gt;
                Mary            112          1&lt;BR /&gt;
  ------------            ---------  ---------&lt;BR /&gt;
  Females                       811          9&lt;BR /&gt;
  ------------            ---------  ---------&lt;BR /&gt;
  Males         Alfred        112.5          1&lt;BR /&gt;
                Henry         102.5          1&lt;BR /&gt;
                James            83          1&lt;BR /&gt;
                Jeffrey          84          1&lt;BR /&gt;
                John           99.5          1&lt;BR /&gt;
                Philip          150          1&lt;BR /&gt;
                Robert          128          1&lt;BR /&gt;
                Ronald          133          1&lt;BR /&gt;
                Thomas           85          1&lt;BR /&gt;
                William         112          1&lt;BR /&gt;
  ------------            ---------  ---------&lt;BR /&gt;
  Males                      1089.5         10&lt;BR /&gt;
  ------------            ---------  ---------&lt;BR /&gt;
  Total Weight               1900.5         19&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
One important thing to note about PROC REPORT is that by default, when you have a BREAK happening (such as the break between Females and Males), then PROC REPORT wants to put that information when the break occurs. In the above report, it does not make sense to ask for the N statistic, because N is 1 on every report line (with a name) and on the summary line, shows the count of female rows or male rows or all rows. And another thing about PROC REPORT is that once the report row has been written (such as the summary line for Females) the N statistic is "reset" so it can accurately reflect the count of Males and the total count. So by the end of the report, the value for N, at the report break will ONLY and ALWAYS be 19.&lt;BR /&gt;
 &lt;BR /&gt;
--SUMMARY reports are reports where ONE report row represents the consolidation of information or summary of information for some group. So, for example, if I had this report:&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC REPORT SUMMARY REPORT&lt;BR /&gt;
&lt;BR /&gt;
                            Count of&lt;BR /&gt;
  Gender           Weight   Students&lt;BR /&gt;
  Females             811          9&lt;BR /&gt;
  Males            1089.5         10&lt;BR /&gt;
  ============  =========  =========&lt;BR /&gt;
  Total Weight     1900.5         19&lt;BR /&gt;
  ============  =========  =========&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The above report would be considered a SUMMARY report -- The report line for females represents the summing up of all the rows for females and the report line for males represents the summing up of all the rows for males from the input data set.&lt;BR /&gt;
 &lt;BR /&gt;
While many of the SAS procedures will do SUMMARY reports (such as PROC FREQ and/or PROC MEANS), the "reporting" procedures that could produce the above report or something similar would be PROC REPORT and PROC TABULATE. In addition, the DATA step program could produce a report such as that shown above. (And I'm sure that somebody who's a wizard with SQL could probably do it in SQL, too.)&lt;BR /&gt;
 &lt;BR /&gt;
Here's an example of the above report done with PROC TABULATE:&lt;BR /&gt;
[pre]&lt;BR /&gt;
PROC TABULATE SUMMARY REPORT&lt;BR /&gt;
&lt;BR /&gt;
+------------------------+&lt;BR /&gt;
|            |Weight | N |&lt;BR /&gt;
+------------+-------+---|&lt;BR /&gt;
|Sex         |       |   |&lt;BR /&gt;
+------------|       |   |&lt;BR /&gt;
|Females     |  811.0|  9|&lt;BR /&gt;
+------------+-------+---|&lt;BR /&gt;
|Males       | 1089.5| 10|&lt;BR /&gt;
+------------+-------+---|&lt;BR /&gt;
|Total Weight| 1900.5| 19|&lt;BR /&gt;
+------------+-------+---+&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
(All these reports are cut and pasted from the LISTING window, they would look much different in ODS HTML, RTF or PDF form.)&lt;BR /&gt;
 &lt;BR /&gt;
As I said at the beginning, what you want to do looks like a DETAIL report with summary information after each "group". So, if I extrapolate from your example you want this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
Department Gender Ethnicity&lt;BR /&gt;
CHEM         F     White&lt;BR /&gt;
             F     Black&lt;BR /&gt;
             F     Hispanic&lt;BR /&gt;
Total Females 3&lt;BR /&gt;
Total Whites 1&lt;BR /&gt;
Total Blacks 1&lt;BR /&gt;
Total Hispanic 1 &lt;BR /&gt;
       &lt;BR /&gt;
CHEM         M     White&lt;BR /&gt;
             M     White&lt;BR /&gt;
             M     Black&lt;BR /&gt;
             M     Black&lt;BR /&gt;
             M     Black&lt;BR /&gt;
             M     Hispanic&lt;BR /&gt;
Total Males 6&lt;BR /&gt;
Total Whites 2&lt;BR /&gt;
Total Blacks 3&lt;BR /&gt;
Total Hispanic 1 &lt;BR /&gt;
     &lt;BR /&gt;
CHEM         &lt;BR /&gt;
Total Employees 9&lt;BR /&gt;
Total Females 3&lt;BR /&gt;
Total Males 6&lt;BR /&gt;
Total Whites 3&lt;BR /&gt;
Total Blacks 4&lt;BR /&gt;
Total Hispanic 2 &lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
... or something like it. I guess I have conflicting ideas about this report -- for small detail reports, I see how this could be useful. But once the employee list gets to be more than 10 people, I wonder whether folks will really want to wade through all the detail lines to get to the "bottom line" or whether they might prefer to just see the summary information for each department and gender group.&lt;BR /&gt;
 &lt;BR /&gt;
It is possible to get the report you want. In my experience, it's probably easier to do the above example report with a DATA step program instead of PROC REPORT. Or you might consider separate reports -- one DETAIL report -- with all the employee details sorted by department, gender and ethnicity, but immediately followed by the summary information. If you are going to use PROC REPORT or DATA step program, you'd have to put that code into a code node in EG, so you could essentially get both your detail and summary reports in 1 HTML file. &lt;BR /&gt;
 &lt;BR /&gt;
If you review the above examples and consider what your report users really want to see -- do they want to see the summary lines interspersed with ALL the detail information (even if there are 100 employees) or do you think they would be happier with a DETAIL report that listed everybody, followed by a SUMMARY report that provided all the "slicing and dicing" summary information???&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 11 Aug 2007 18:39:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4150#M1318</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-08-11T18:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: proc report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4151#M1319</link>
      <description>I want my report should be  DETAIL report with summary information after each group.  EX:   &lt;BR /&gt;
 CHEM        Instructor                 Black           F&lt;BR /&gt;
                  Professor                 Black            M&lt;BR /&gt;
                  Instructor                 Hisp             F&lt;BR /&gt;
Total Males:    1                                      Females:        2&lt;BR /&gt;
Whites            0                                                           0&lt;BR /&gt;
Blacks            1                                                           1&lt;BR /&gt;
Hisp                0                                                           1&lt;BR /&gt;
Asians             0                                                           0&lt;BR /&gt;
&lt;BR /&gt;
MATH         INSTRUCTOR             White             M  &lt;BR /&gt;
&lt;BR /&gt;
and so on.&lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
Raji&lt;BR /&gt;
I would like to get the results for summary info for each group</description>
      <pubDate>Mon, 13 Aug 2007 13:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4151#M1319</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-08-13T13:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: proc report</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4152#M1320</link>
      <description>Hi:&lt;BR /&gt;
  There are several different ways to do the report. If I had to pick between PROC REPORT and DATA step program, I guess I'd pick a DATA step program, because it allows me to set counting variables AND produce the report with one pass through the data. Even in PROC REPORT you have to set up counting variables to make this kind of report work, with so many summary lines after the detail section.&lt;BR /&gt;
 &lt;BR /&gt;
  So, using SASHELP.CLASS, I can produce this report with a DATA step program.&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data Step Detail Report With Summary Info&lt;BR /&gt;
&lt;BR /&gt;
             Name                 Gender    Height    Age&lt;BR /&gt;
&lt;BR /&gt;
Alfred                            M           69.0     14&lt;BR /&gt;
Alice                             F           56.5     13&lt;BR /&gt;
Barbara                           F           65.3     13&lt;BR /&gt;
Carol                             F           62.8     14&lt;BR /&gt;
Henry                             M           63.5     14&lt;BR /&gt;
James                             M           57.3     12&lt;BR /&gt;
Jane                              F           59.8     12&lt;BR /&gt;
Janet                             F           62.5     15&lt;BR /&gt;
Jeffrey                           M           62.5     13&lt;BR /&gt;
John                              M           59.0     12&lt;BR /&gt;
Joyce                             F           51.3     11&lt;BR /&gt;
Judy                              F           64.3     14&lt;BR /&gt;
Louise                            F           56.3     12&lt;BR /&gt;
Mary                              F           66.5     15&lt;BR /&gt;
Philip                            M           72.0     16&lt;BR /&gt;
Robert                            M           64.8     12&lt;BR /&gt;
Ronald                            M           67.0     15&lt;BR /&gt;
Thomas                            M           57.5     11&lt;BR /&gt;
William                           M           66.5     15&lt;BR /&gt;
Total Females:   9&lt;BR /&gt;
Total Males:  10&lt;BR /&gt;
Tall Students:  12&lt;BR /&gt;
Short Students:   7&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
The program used to generate this output is shown at the bottom of this post.&lt;BR /&gt;
&lt;BR /&gt;
For help with the programming logic of the program or for help tailoring the program to your data, your best bet is to contact Tech Support. You will need to use BY group processing and FIRST.byvar or LAST.byvar in order to correctly generate the report BY DEPARTMENT, for example.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
   &lt;BR /&gt;
ods html file='c:\temp\detail_with_summary_data.html' style=egdefault;&lt;BR /&gt;
  title 'Data Step Detail Report With Summary Info';&lt;BR /&gt;
  title2 ' ';&lt;BR /&gt;
  options missing = ' ' nodate nonumber;&lt;BR /&gt;
   &lt;BR /&gt;
  ** start the programming environment to calculate the counters;&lt;BR /&gt;
  ** that I want to show;&lt;BR /&gt;
  data _null_;&lt;BR /&gt;
    ** reset the length of Name so it can hold the summary line;&lt;BR /&gt;
    length Name $30;&lt;BR /&gt;
    set sashelp.class end=no_more_data;&lt;BR /&gt;
    ** retain counters;&lt;BR /&gt;
    retain fcnt mcnt tcnt scnt 0;&lt;BR /&gt;
    ** increment counters for each record;&lt;BR /&gt;
    if sex = 'M' then mcnt + 1;&lt;BR /&gt;
      else if sex = 'F' then fcnt + 1;&lt;BR /&gt;
    if height ge 60 then tcnt + 1;&lt;BR /&gt;
      else if height lt 60 then scnt + 1;&lt;BR /&gt;
    ** start sending the report to ODS;&lt;BR /&gt;
    file print ods=(variables=(name sex height age));&lt;BR /&gt;
    ** write the 4 columns listed in the variables= option;&lt;BR /&gt;
    ** This will write out EVERY data row.;&lt;BR /&gt;
    put _ods_;&lt;BR /&gt;
    if no_more_data then do;&lt;BR /&gt;
       ** at the end of the file "reset" the value for name;&lt;BR /&gt;
       ** so it holds the summary line info;&lt;BR /&gt;
       ** then write out the name to column 1;&lt;BR /&gt;
       ** Note, Name field had to be bigger than the "old" name field;&lt;BR /&gt;
       ** to hold the string that I wanted for the summary line.;&lt;BR /&gt;
       name = 'Total Females: '|| put(fcnt,3.0);&lt;BR /&gt;
       put @1 name ;&lt;BR /&gt;
       name = 'Total Males: '|| put(mcnt,3.0);&lt;BR /&gt;
       put @1 name  ;&lt;BR /&gt;
       name = 'Tall Students: '|| put(tcnt,3.0); &lt;BR /&gt;
       put @1  name;&lt;BR /&gt;
       name = 'Short Students: '|| put(scnt,3.0);&lt;BR /&gt;
       put @1 name ;&lt;BR /&gt;
    end;&lt;BR /&gt;
    format age 3.0 height 6.1 sex $6.;&lt;BR /&gt;
    label sex = 'Gender';&lt;BR /&gt;
  run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Mon, 13 Aug 2007 19:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-report/m-p/4152#M1320</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-08-13T19:10:53Z</dc:date>
    </item>
  </channel>
</rss>

