<?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 - using preloadfmt with conditional formatting in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432924#M68765</link>
    <description>&lt;P&gt;I have had preloadfmt and completerows working, but not in the style that I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was originally trying to get the same result, but with a single format like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value scoref_orig
		500-501 = "500-501"
		502-503 = "502-503"
		504-505 = "504-505"
		506-507 = "506-507"
		508-509 = "508-509"
		510-511 = "510-511"
		512-513 = "512-513"
		. = "."
		0 = "0"
	;
run;

title "Overall";
proc report data=temp missing completerows;
	column unscorable score i bad;

	define unscorable / group noprint;
	define score / group "Score" format=scoref_orig. preloadfmt;
	define i / analysis sum "#";
	define bad / analysis sum "# Bad";

	break after unscorable / ol ul summarize;
	rbreak after / ol ul summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This worked, but it preloads the entire format for both unscorable = 1 and unscorable = 0. I would like just the values of unscf to be present when unscorable = 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the same result could be achieved using a single format that would be ideal, but it seemed to me that splitting up the format and applying it separately might be easier to start.&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jan 2018 21:41:48 GMT</pubDate>
    <dc:creator>Phase2</dc:creator>
    <dc:date>2018-01-31T21:41:48Z</dc:date>
    <item>
      <title>Proc report - using preloadfmt with conditional formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432899#M68757</link>
      <description>&lt;P&gt;Sorry if this a duplicate posting, I tried to edit my previous version of this question and I can no longer find it so I'm asking again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I am using SAS v 9.4 and I want to create a report that displays every level of a format that is being applied. I am conditionally applying formats to a secondary group variable based on the value of a primary group variable and I want each value of the appropriate format to appear in the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example data set:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
	input score unscorable bad segment $ i;
datalines;
. 1 1 B 1
. 1 0 B 1
. 1 1 B 1
0 1 0 A 1
0 1 1 A 1
0 1 1 A 1
500 0 1 A 1
501 0 1 B 1
501 0 0 A 1
501 0 1 A 1
503 0 0 A 1
503 0 1 A 1
504 0 0 B 1
505 0 0 B 1
506 0 1 B 1
507 0 0 B 1
508 0 0 A 1
509 0 0 B 1
510 0 0 A 1
510 0 0 B 1
510 0 0 A 1
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;These are the two formats I am using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value scoref
		500-501 = "500-501"
		502-503 = "502-503"
		504-505 = "504-505"
		506-507 = "506-507"
		508-509 = "508-509"
		510-511 = "510-511"
		512-513 = "512-513"
	;
	value unscf
		. = "."
		0 = "0"
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And here is my proc report:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Overall";
proc report data=temp missing;
	column unscorable _unscorable score i bad;

	define unscorable / group noprint;
	define _unscorable / computed noprint;
	define score / group "Score";
	define i / analysis sum "#";
	define bad / analysis sum "# Bad";

	compute _unscorable;
		if unscorable not = ' ' then do;
			hold = unscorable;
		end;
		_unscorable = hold;
	endcomp;

	compute score;
		if _unscorable = 0 then do;
			call define('score', 'format', 'scoref.');
		end;
		else if _unscorable = 1 then do;
			call define('score', 'format', 'unscf.');
		end;
	endcomp;

	break after unscorable / ol ul summarize;
	rbreak after / ol ul summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Right now the "512-513" level of scoref is not being displayed in this report. What I would like is for all levels of scoref to show up when _unscorable = 0 and all levels of unscf to show up when _unscorable = 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventually, I am planning on creating two tables, one for segment = A and one for segment = B. I would like these tables to have the same number of rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried using preloadfmt with completerows, but can't get it to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 20:29:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432899#M68757</guid>
      <dc:creator>Phase2</dc:creator>
      <dc:date>2018-01-31T20:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - using preloadfmt with conditional formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432916#M68761</link>
      <description>Hi, PROC REPORT has some fairly specific rules about using the preloadfmt option. for example, in this paper: &lt;A href="http://support.sas.com/resources/papers/proceedings11/239-2011.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings11/239-2011.pdf&lt;/A&gt; notice the use of PRELOADFMT option and then either COMPLETEROWS or COMPLETECOLS, depending on whether your format is for an ORDER or GROUP item or for an ACROSS item.&lt;BR /&gt;&lt;BR /&gt;cynthia</description>
      <pubDate>Wed, 31 Jan 2018 21:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432916#M68761</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-01-31T21:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report - using preloadfmt with conditional formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432924#M68765</link>
      <description>&lt;P&gt;I have had preloadfmt and completerows working, but not in the style that I want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was originally trying to get the same result, but with a single format like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
	value scoref_orig
		500-501 = "500-501"
		502-503 = "502-503"
		504-505 = "504-505"
		506-507 = "506-507"
		508-509 = "508-509"
		510-511 = "510-511"
		512-513 = "512-513"
		. = "."
		0 = "0"
	;
run;

title "Overall";
proc report data=temp missing completerows;
	column unscorable score i bad;

	define unscorable / group noprint;
	define score / group "Score" format=scoref_orig. preloadfmt;
	define i / analysis sum "#";
	define bad / analysis sum "# Bad";

	break after unscorable / ol ul summarize;
	rbreak after / ol ul summarize;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This worked, but it preloads the entire format for both unscorable = 1 and unscorable = 0. I would like just the values of unscf to be present when unscorable = 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the same result could be achieved using a single format that would be ideal, but it seemed to me that splitting up the format and applying it separately might be easier to start.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2018 21:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-report-using-preloadfmt-with-conditional-formatting/m-p/432924#M68765</guid>
      <dc:creator>Phase2</dc:creator>
      <dc:date>2018-01-31T21:41:48Z</dc:date>
    </item>
  </channel>
</rss>

