<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121404#M33456</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; You don't provide a USAGE for&amp;nbsp; the BMI&amp;nbsp; variable so if it is a numeric variable, then it is using the SUM statistic by default. And the same thing would be true of Result1 and Result2. Without a usage in the DEFINE statement, you get the SUM statistic for numeric variables by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first method to fix your problem is to take the defaults for numeric variables in your DEFINE statement and alter your COMPUTE blocks. This means that in a COMPUTE block you have to use the compound reference of &lt;EM style="font-size: 12pt;"&gt;&lt;STRONG&gt;varname.statisticname&lt;/STRONG&gt;&lt;/EM&gt; in the COMPUTE block. So BMI.SUM and RESULT1.SUM and RESULT2.SUM:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute BMI_Cat / character&amp;nbsp; length=10;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if BMI.sum le 18.5 then BMI_Cat = 'Underweight';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 18.5 and BMI.sum le 25 then BMI_Cat = 'Normal';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 25 and BMI .sum le 30 then BMI_Cat = 'Overweight';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 30 then BMI_Cat = 'Obese';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; compute Ab_Change;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ab_change = Result1.sum - Result2.sum;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;This is what you would need to do with the current DEFINE statements that you have. The upside of this approach is that if you want to add subtotals or grand totals, you can do that. But since you are getting a detail report (one row for every PT_ID you may not want a grand total summary line). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;And, there is an alternative. The second approach is to keep your&amp;nbsp; COMPUTE blocks the way they are and alter the DEFINE statements to specify a non-statistic usage:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;Result1&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; 'Analyte Result 1' width=8 format=8.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;Result2&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; 'Analyte Result 2' width=8 format=8.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;BMI&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; width=3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;The upside of this approach is that you don't have to change the COMPUTE block. The downside of this approach is that if you EVER want to get grand totals or subtotals, you'll have to get rid of DISPLAY (and either take the default or change the statistic), and then you're back to needing to change your COMPUTE block.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;cynthia&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Feb 2013 22:47:20 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2013-02-25T22:47:20Z</dc:date>
    <item>
      <title>PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121403#M33455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is my code. The output is giving me blanks for the two computed columns BMI_Cat and Ab_Change and I cannot figure out why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=combine nowd headskip missing;&lt;/P&gt;&lt;P&gt;&amp;nbsp; column Pt_Id Dosedate Age Sex Race Wt_Cat BMI BMI_Cat Result1 Result2 Ab_Change;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Pt_Id / order 'Patient' width=7;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Dosedate / width=8 format=mmddyy8.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Age / 'Age' width=3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Sex / width=6;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Race / width=9;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Wt_Cat / 'Weight Category' width=16;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Result1 / 'Analyte Result 1' width=8 format=8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Result2 / 'Analyte Result 2' width=8 format=8.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define Ab_Change / computed 'Absolute Change';&lt;/P&gt;&lt;P&gt;&amp;nbsp; define BMI / width=3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; define BMI_Cat / computed 'BMI Category' width=10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; compute BMI_Cat / character&amp;nbsp; length=10;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if BMI lt 18.5 then BMI_Cat = 'Underweight';&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if BMI gt 18.5 and BMI lt 25 then BMI_Cat = 'Normal';&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if BMI gt 25 and BMI lt 30 then BMI_Cat = 'Overweight';&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if BMI gt 30 then BMI_Cat = 'Obese';&lt;/P&gt;&lt;P&gt;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; compute Ab_Change;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Ab_change = Result1 - Result2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 22:15:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121403#M33455</guid>
      <dc:creator>SASFNG</dc:creator>
      <dc:date>2013-02-25T22:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121404#M33456</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; You don't provide a USAGE for&amp;nbsp; the BMI&amp;nbsp; variable so if it is a numeric variable, then it is using the SUM statistic by default. And the same thing would be true of Result1 and Result2. Without a usage in the DEFINE statement, you get the SUM statistic for numeric variables by default.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first method to fix your problem is to take the defaults for numeric variables in your DEFINE statement and alter your COMPUTE blocks. This means that in a COMPUTE block you have to use the compound reference of &lt;EM style="font-size: 12pt;"&gt;&lt;STRONG&gt;varname.statisticname&lt;/STRONG&gt;&lt;/EM&gt; in the COMPUTE block. So BMI.SUM and RESULT1.SUM and RESULT2.SUM:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;compute BMI_Cat / character&amp;nbsp; length=10;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if BMI.sum le 18.5 then BMI_Cat = 'Underweight';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 18.5 and BMI.sum le 25 then BMI_Cat = 'Normal';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 25 and BMI .sum le 30 then BMI_Cat = 'Overweight';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if BMI.sum gt 30 then BMI_Cat = 'Obese';&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; compute Ab_Change;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Ab_change = Result1.sum - Result2.sum;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; endcomp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;This is what you would need to do with the current DEFINE statements that you have. The upside of this approach is that if you want to add subtotals or grand totals, you can do that. But since you are getting a detail report (one row for every PT_ID you may not want a grand total summary line). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;And, there is an alternative. The second approach is to keep your&amp;nbsp; COMPUTE blocks the way they are and alter the DEFINE statements to specify a non-statistic usage:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;Result1&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; 'Analyte Result 1' width=8 format=8.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;Result2&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; 'Analyte Result 2' width=8 format=8.2;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; define &lt;SPAN style="color: #ff00ff;"&gt;BMI&lt;/SPAN&gt; / &lt;SPAN style="color: #ff00ff;"&gt;DISPLAY&lt;/SPAN&gt; width=3;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;The upside of this approach is that you don't have to change the COMPUTE block. The downside of this approach is that if you EVER want to get grand totals or subtotals, you'll have to get rid of DISPLAY (and either take the default or change the statistic), and then you're back to needing to change your COMPUTE block.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;cynthia&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 22:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121404#M33456</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2013-02-25T22:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121405#M33457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. That makes perfect sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Crystal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 23:11:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-REPORT/m-p/121405#M33457</guid>
      <dc:creator>SASFNG</dc:creator>
      <dc:date>2013-02-25T23:11:47Z</dc:date>
    </item>
  </channel>
</rss>

