<?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: Modifying proc template picture statement for crosstabulation rowpercent values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960637#M374630</link>
    <description>Wow. This worked exactly how I needed it to. I am very appreciative for your solution and will see if I can change the title of my post to reflect using format instead of template.</description>
    <pubDate>Sat, 01 Mar 2025 23:53:32 GMT</pubDate>
    <dc:creator>abaker_ca</dc:creator>
    <dc:date>2025-03-01T23:53:32Z</dc:date>
    <item>
      <title>Modifying proc template picture statement for crosstabulation rowpercent values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960614#M374623</link>
      <description>&lt;P&gt;I am trying to modify a picture statement in my proc template code so that values in my proc tabulate output where there are no observations for a combination in a crosstabulation appear as 0 for the count and&amp;nbsp; (0.0%) for the rowpercent contents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a toy data set and my proc template and proc tabulate codes. Can someone help me figure out how to get the cell for the 'Site A' and 'POS' combination to be represented as (0.0%) for the percent row and just a zero for the count row?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;data want;&lt;/DIV&gt;&lt;DIV&gt;input id 1-1 site $4 result $6-8;&lt;/DIV&gt;&lt;DIV&gt;datalines;&lt;/DIV&gt;&lt;DIV&gt;1&amp;nbsp; A NEG&lt;/DIV&gt;&lt;DIV&gt;2&amp;nbsp; A NEG&lt;/DIV&gt;&lt;DIV&gt;3&amp;nbsp; B POS&lt;/DIV&gt;&lt;DIV&gt;4&amp;nbsp; C NEG&lt;/DIV&gt;&lt;DIV&gt;5&amp;nbsp; C POS&lt;/DIV&gt;&lt;DIV&gt;6&amp;nbsp; A NEG&lt;/DIV&gt;&lt;DIV&gt;7&amp;nbsp; B POS&lt;/DIV&gt;&lt;DIV&gt;8&amp;nbsp; C POS&lt;/DIV&gt;&lt;DIV&gt;9&amp;nbsp; D POS&lt;/DIV&gt;&lt;DIV&gt;10 B NEG&lt;/DIV&gt;&lt;DIV&gt;11 C NEG&lt;/DIV&gt;&lt;DIV&gt;12 A NEG&lt;/DIV&gt;&lt;DIV&gt;13 B POS&lt;/DIV&gt;&lt;DIV&gt;14 C NEG&lt;/DIV&gt;&lt;DIV&gt;15 B POS&lt;/DIV&gt;&lt;DIV&gt;16 B NEG&lt;/DIV&gt;&lt;DIV&gt;17 D POS&lt;/DIV&gt;&lt;DIV&gt;18 D NEG&lt;/DIV&gt;&lt;DIV&gt;19 B POS&lt;/DIV&gt;&lt;DIV&gt;20 C NEG&lt;/DIV&gt;&lt;DIV&gt;;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc format;&lt;/DIV&gt;&lt;DIV&gt;picture pctfm (round) low-high='0000.0%)'&lt;/DIV&gt;&lt;DIV&gt;(prefix='(');&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc tabulate data=want;&lt;/DIV&gt;&lt;DIV&gt;class site result;&lt;/DIV&gt;&lt;DIV&gt;table ALL = 'N Per Site' result * (N COLPCTN='%'*F=pctfm.),&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; site;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;</description>
      <pubDate>Sat, 01 Mar 2025 14:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960614#M374623</guid>
      <dc:creator>abaker_ca</dc:creator>
      <dc:date>2025-03-01T14:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying proc template picture statement for crosstabulation rowpercent values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960618#M374627</link>
      <description>&lt;P&gt;I am not a 100 percent sure I understand exactly what appearance you want. Is this close?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; 
proc format;
picture pctfm (round) 
low-high='0000.0%)' (prefix='(')
. = '(0.0%)' (noedit)
;
run;
 
proc tabulate data=want;
class site result;
table ALL = 'N Per Site' result * (N COLPCTN='%'*F=pctfm.),
  site / misstext='0';
run;&lt;/PRE&gt;
&lt;P&gt;The NOEDIT option has the digits in the format display exactly as written and not treated as digit selectors and use of the single . indicates only applies to that value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MISSTEXT tabulate table option would apply to all other "missing" values displayed. So depending on the complexity of the table you might want a custom format for the N statistic instead of the table option. The format and code might look like:&lt;/P&gt;
&lt;PRE&gt; 
proc format;
picture pctfm (round) 
low-high='0000.0%)' (prefix='(')
. = '(0.0%)' (noedit)
;

value zeromiss
. = '0'
;

run;
 
proc tabulate data=want;
class site result;
table ALL = 'N Per Site' result * (N*f=zeromiss. COLPCTN='%'*F=pctfm.),
  site / ;
run;&lt;/PRE&gt;
&lt;P&gt;Ranges of values might want a Default length or explicit width when using the custom format Zeromiss.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW may want to edit the title of the thread to remove TEMPLATE and say FORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Mar 2025 15:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960618#M374627</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-03-01T15:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying proc template picture statement for crosstabulation rowpercent values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960637#M374630</link>
      <description>Wow. This worked exactly how I needed it to. I am very appreciative for your solution and will see if I can change the title of my post to reflect using format instead of template.</description>
      <pubDate>Sat, 01 Mar 2025 23:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960637#M374630</guid>
      <dc:creator>abaker_ca</dc:creator>
      <dc:date>2025-03-01T23:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying proc template picture statement for crosstabulation rowpercent values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960647#M374634</link>
      <description>&lt;P&gt;I think if you right click on the three-line icon at your subject heading you get an "edit" option. Select that and retype in the subject line.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Mar 2025 03:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modifying-proc-template-picture-statement-for-crosstabulation/m-p/960647#M374634</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-03-02T03:13:16Z</dc:date>
    </item>
  </channel>
</rss>

