<?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: Using compute in PROC REPORT with subcolumns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349254#M80986</link>
    <description>&lt;P&gt;Since your format said 0-&amp;lt;0.001 = '&amp;lt;0.001' and the value you mention is 0.0009 it is doing what you told it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would have to manually round before applying the format. Note that SAS supplies a PVALUE format you can use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x= 0.0009;
   put x= pvalue6.3;
   x= round(x,0.001);
   put x= pvalue6.3;
run;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Apr 2017 20:20:25 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-04-11T20:20:25Z</dc:date>
    <item>
      <title>Using compute in PROC REPORT with subcolumns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349236#M80981</link>
      <description>&lt;P&gt;Using SUDAAN's proc descript I outputted a dataset that contains p-values. I would like to create a report that shows the p-values rounded to 3 decimals places by sex (in the dataset it's 4 decimal places). The report should look like this:&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Variable&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;sex&lt;/TD&gt;&lt;TD&gt;sex&lt;/TD&gt;&lt;TD&gt;sex&lt;/TD&gt;&lt;TD&gt;sex&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Male&lt;/TD&gt;&lt;TD&gt;Female&lt;/TD&gt;&lt;TD&gt;Male&lt;/TD&gt;&lt;TD&gt;Female&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CONTRAST&lt;/TD&gt;&lt;TD&gt;pval&lt;/TD&gt;&lt;TD&gt;pval&lt;/TD&gt;&lt;TD&gt;pval&lt;/TD&gt;&lt;TD&gt;pval&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Latino vs. non-Latino&lt;/TD&gt;&lt;TD&gt;&amp;lt;0.001&lt;/TD&gt;&lt;TD&gt;0.002&lt;/TD&gt;&lt;TD&gt;0.006&lt;/TD&gt;&lt;TD&gt;0.001&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;US born vs FB&lt;/TD&gt;&lt;TD&gt;0.589&lt;/TD&gt;&lt;TD&gt;0.056&lt;/TD&gt;&lt;TD&gt;0.005&lt;/TD&gt;&lt;TD&gt;&amp;lt;0.001&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I'm running into a couple of issues:&lt;/P&gt;&lt;P&gt;1) When I try to use a format statement to round, if, for example, a p-value is 0.0009 it's incorrectly printed as "&amp;lt;0.001" instead of "0.001."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc format;
value pv 
0-&amp;lt;0.001='&amp;lt;0.001'
other=[5.3];
run;&lt;BR /&gt;proc report data=tt nowindows ;&lt;BR /&gt; column (contrast) variable, sex, (p_pct) ;&lt;BR /&gt; define contrast / group format=test. order=internal ;&lt;BR /&gt; define variable / across nozero order=internal ;&lt;BR /&gt; define sex / 'sex' across nozero order=internal ;&lt;BR /&gt; define p_pct / 'pval' format=pv. ;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;2) As a workaround I tried using a compute block, However I can't get my subcolumns. When I use this code&lt;/P&gt;&lt;PRE&gt;proc report data=tt  nowindows ;
	column (contrast) variable, sex, (p_pct pval) ;
	define contrast / group format=test. order=internal ;
	define variable / across nozero order=internal ;
	define sex / 'sex' across nozero  order=internal ;
	define p_pct /  noprint ;
	define pval / computed format=pv.;
	compute pval;
		pval=round(p_pct,0.001);
	endcomp;
	where contrast in (1:6,17);
run;&lt;/PRE&gt;&lt;P&gt;I get an error message:&amp;nbsp;ERROR: Variable p_pct is uninitialized&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code&amp;nbsp;&lt;EM&gt;works&lt;/EM&gt; but sex is no longer a column header and I don't want to display p_pct, only pval.&lt;/P&gt;&lt;PRE&gt;proc report data=tt  nowindows ;
	column (contrast) variable, sex p_pct pval  ;
	define contrast / group format=test. order=internal ;
	define variable / across nozero order=internal ;
	define sex / 'sex'  nozero  order=internal ;
	define p_pct / 'p_pct' display ;
	define pval / computed format=pv.;
	compute pval;
		pval=round(p_pct,0.001);
	endcomp;
	where contrast in (1:6,17);
run;&lt;/PRE&gt;&lt;P&gt;Any assistance would be helpful. Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;P.S. Using SAS 9.4&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 19:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349236#M80981</guid>
      <dc:creator>nd</dc:creator>
      <dc:date>2017-04-11T19:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using compute in PROC REPORT with subcolumns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349254#M80986</link>
      <description>&lt;P&gt;Since your format said 0-&amp;lt;0.001 = '&amp;lt;0.001' and the value you mention is 0.0009 it is doing what you told it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would have to manually round before applying the format. Note that SAS supplies a PVALUE format you can use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   x= 0.0009;
   put x= pvalue6.3;
   x= round(x,0.001);
   put x= pvalue6.3;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2017 20:20:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349254#M80986</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-11T20:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using compute in PROC REPORT with subcolumns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349257#M80987</link>
      <description>&lt;P&gt;Thanks. I was afraid that I would need a dataset; was hoping that using a compute block could be a workaround. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 20:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-compute-in-PROC-REPORT-with-subcolumns/m-p/349257#M80987</guid>
      <dc:creator>nd</dc:creator>
      <dc:date>2017-04-11T20:22:29Z</dc:date>
    </item>
  </channel>
</rss>

