<?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 Quest in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Quest/m-p/20163#M4179</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; This question would be easier to answer if we knew what your data looked like. Your PROC REPORT statements are incorrect...you can't have the same variable defined with ACROSS, GROUP and an ANALYSIS (N) usage. So even though PROC REPORT doesn't give you a message in the log, your syntax is confusing. Also, your syntax includes references to LISTING only options (such as HEADLINE and WIDTH= that would not work for ODS HTML, ODS PDF or ODS RTF).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The code for me produced exactly the same table in TABULATE vs REPORT. PROC TABULATE provides the N statistic automatically for CLASS variables. For PROC REPORT, the comma operator is used to place a statistic or a statistic based on another variable "underneath" the across variable values. So, the second PROC REPORT step shows how to get the MEAN of HEIGHT and WEIGHT "underneath" each unique value for the SEX variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data history (keep= name smoking alcohol);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; ** make some fake data;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age lt 13 then smoking = 'No ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else smoking = 'Yes';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if substr(name,1,2) le 'Je' then alcohol = 'No ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else alcohol='Yes';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=history;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; var name smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\across.html';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc tabulate data=history;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title 'TABULATE method';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; class smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; table smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; keylabel n=' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=history nowd ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title 'REPORT method';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column smoking,n alcohol,n;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define smoking / across ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define alcohol / across;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define n / ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=sashelp.class nowd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; title 'Showing different use of the comma operator';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column age sex,(height weight);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define age / group;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define sex / across 'Gender Averages by Age';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define height / mean 'Height' f=comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define weight / mean 'Weight' f=comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Mar 2012 19:38:09 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2012-03-02T19:38:09Z</dc:date>
    <item>
      <title>Proc Report Quest</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Quest/m-p/20162#M4178</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SASeers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to generate a table using Proc Report and it has to look this:&lt;/P&gt;&lt;P&gt;Using the code below I am getting No/Yes below each other and not across.&lt;/P&gt;&lt;P&gt;I could get the exact thing using Proc Tabulate but not with Report.&lt;/P&gt;&lt;P&gt;My code is:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=clin1.history nowd&amp;nbsp; headline ;&lt;/P&gt;&lt;P&gt;column smoking N alcohol N;&lt;/P&gt;&lt;P&gt;define smoking / n 'Smoking' group width=5;&lt;/P&gt;&lt;P&gt;define smoking / across group width=3;&lt;/P&gt;&lt;P&gt;/*define n / width=5 ;*/&lt;/P&gt;&lt;P&gt;define alcohol / n 'Alcohol'group width=5;&lt;/P&gt;&lt;P&gt;define alcohol / group width=3;&lt;/P&gt;&lt;P&gt;/*define n / width=5 ;*/&lt;/P&gt;&lt;P&gt;format smoking alcohol $ynfmt.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="center" style="text-align: left;"&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="0" cellspacing="0" style="margin-left: -20.95pt; padding: 5.25pt;"&gt;&lt;THEAD&gt;&lt;TR&gt;&lt;TD colspan="2" style="border: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;Smoking&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD colspan="2" style="border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;Alcohol&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: windowtext 1pt solid; border-bottom: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;No&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;No&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;Yes&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: windowtext 1pt solid; border-bottom: windowtext 1pt solid; padding: 5.25pt;" valign="bottom"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;4&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;" valign="bottom"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;16&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;" valign="bottom"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;17&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD style="border-right: windowtext 1pt solid; border-top: medium none; border-left: medium none; border-bottom: windowtext 1pt solid; padding: 5.25pt;" valign="bottom"&gt;&lt;P align="center"&gt;&lt;SPAN style="font-size: 10pt; color: windowtext;"&gt;3&lt;/SPAN&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;STRONG style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;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t;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 14:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Quest/m-p/20162#M4178</guid>
      <dc:creator>hnam</dc:creator>
      <dc:date>2012-03-02T14:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Quest</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Quest/m-p/20163#M4179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; This question would be easier to answer if we knew what your data looked like. Your PROC REPORT statements are incorrect...you can't have the same variable defined with ACROSS, GROUP and an ANALYSIS (N) usage. So even though PROC REPORT doesn't give you a message in the log, your syntax is confusing. Also, your syntax includes references to LISTING only options (such as HEADLINE and WIDTH= that would not work for ODS HTML, ODS PDF or ODS RTF).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The code for me produced exactly the same table in TABULATE vs REPORT. PROC TABULATE provides the N statistic automatically for CLASS variables. For PROC REPORT, the comma operator is used to place a statistic or a statistic based on another variable "underneath" the across variable values. So, the second PROC REPORT step shows how to get the MEAN of HEIGHT and WEIGHT "underneath" each unique value for the SEX variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;data history (keep= name smoking alcohol);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; ** make some fake data;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if age lt 13 then smoking = 'No ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else smoking = 'Yes';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; if substr(name,1,2) le 'Je' then alcohol = 'No ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; else alcohol='Yes';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods listing;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=history;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; var name smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods listing close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\across.html';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc tabulate data=history;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title 'TABULATE method';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; class smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; table smoking alcohol;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; keylabel n=' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=history nowd ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title 'REPORT method';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column smoking,n alcohol,n;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define smoking / across ;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define alcohol / across;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define n / ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc report data=sashelp.class nowd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; title 'Showing different use of the comma operator';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; column age sex,(height weight);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define age / group;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define sex / across 'Gender Averages by Age';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define height / mean 'Height' f=comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define weight / mean 'Weight' f=comma6.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Mar 2012 19:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Quest/m-p/20163#M4179</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-03-02T19:38:09Z</dc:date>
    </item>
  </channel>
</rss>

