<?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: Accessing BY Group in PROC REPORT COMPUTE Block in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390749#M19154</link>
    <description>&lt;P&gt;Proc report requires that any variable referenced in a calculation be to the left of the position it is being refenced. So you will want to add SEX to columns, left height. Set the option NOPRINT for SEX in a define block.&lt;/P&gt;
&lt;P&gt;Such as&lt;/P&gt;
&lt;P&gt;define sex /display noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you be a bit closer to your goal&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2017 20:24:44 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-08-24T20:24:44Z</dc:date>
    <item>
      <title>Accessing BY Group in PROC REPORT COMPUTE Block</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390745#M19152</link>
      <description>&lt;P&gt;Here's what I'm trying to do in a very simplified example. For my PROC REPORT output, I want some columns of my output to be in italic if the BY group variable is a certain value, and otherwise not in italic. But the way I am doing it, it doesn't work, no italics appear and there is a message in the log. Code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sort data=sashelp.class out=class;
	by sex;
run;
ods_html;
proc report data=class;
	by sex;
	columns name height weight;
	define name/group;
	compute height;
		if sex='F' then call define('_c2_',"style","style=[fontstyle=italic]");
	endcompute;
run;
ods html close;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;1433  proc report data=class;
1434      by sex;
1435      columns name height weight;
1436      define name/group;
1437      compute height;
1438          if sex='F' then call define('_c2_',"style","style=[fontstyle=italic]");
1439      endcompute;
1440  run;

NOTE: Variable sex is uninitialized.
NOTE: The above message was for the following BY group:
      Sex=F
NOTE: Variable sex is uninitialized.
NOTE: The above message was for the following BY group:
      Sex=M
NOTE: There were 19 observations read from the data set WORK.CLASS.
NOTE: PROCEDURE REPORT used (Total process time):
      real time           0.04 seconds
      cpu time            0.03 seconds


1441  ods html close;
&lt;/PRE&gt;
&lt;P&gt;Can this work? How can I reference the BY variable in the COMPUTE block?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 20:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390745#M19152</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-24T20:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing BY Group in PROC REPORT COMPUTE Block</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390747#M19153</link>
      <description>&lt;P&gt;You got next message in the log: &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;NOTE: Variable sex is uninitialized.&lt;/PRE&gt;
&lt;P&gt;I suppose you have to add SEX to COLUMNS staement ?!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 20:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390747#M19153</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-08-24T20:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing BY Group in PROC REPORT COMPUTE Block</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390749#M19154</link>
      <description>&lt;P&gt;Proc report requires that any variable referenced in a calculation be to the left of the position it is being refenced. So you will want to add SEX to columns, left height. Set the option NOPRINT for SEX in a define block.&lt;/P&gt;
&lt;P&gt;Such as&lt;/P&gt;
&lt;P&gt;define sex /display noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you be a bit closer to your goal&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 20:24:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390749#M19154</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-24T20:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing BY Group in PROC REPORT COMPUTE Block</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390775#M19159</link>
      <description>&lt;P&gt;Well, duh, I knew that but for some reason, I didn't think it applied to BY variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the code does what I want now. Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 21:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390775#M19159</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-24T21:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing BY Group in PROC REPORT COMPUTE Block</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390778#M19161</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Well, duh, I knew that but for some reason, I didn't think it applied to BY variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the code does what I want now. Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I swear that I have absolutely, never ever had to say "I knew that but ..." about my code. Honest. Really.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 21:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Accessing-BY-Group-in-PROC-REPORT-COMPUTE-Block/m-p/390778#M19161</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-24T21:59:51Z</dc:date>
    </item>
  </channel>
</rss>

