<?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: Help with PROC TABULATE Formatting in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/962129#M83932</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Koen(@sbxkoenk),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks so much for your reply!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) I've tried what you suggested. I've gotten to the point of removing the rows with the 0's that I don't want to display. I'm having some issues formatting the proc tabulate statement to display the outputted dataset from the first proc tabulate. Do you have any guidance on this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) Worked perfectly!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Mar 2025 18:31:12 GMT</pubDate>
    <dc:creator>hr667</dc:creator>
    <dc:date>2025-03-18T18:31:12Z</dc:date>
    <item>
      <title>Help with PROC TABULATE Formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/953126#M83803</link>
      <description>&lt;P&gt;Hello, I'm trying to format a table in a report I am programing. I'm having some issues that I haven't been able to work through on my own, and I was wondering if there even is a way to do what I'm trying to do!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below are some sample data and my current PROC TABULATE step.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data table1;
input sn q1n q2n arm age_cat patient_gender patient_pcp;&lt;BR /&gt;label &lt;BR /&gt;sn = "Screened"&lt;BR /&gt;q1n = "Eligible"&lt;BR /&gt;q2n = "Consented"&lt;BR /&gt;age_cat = "Age"&lt;BR /&gt;patient_pcp = "Has Primary Care Physician"&lt;BR /&gt;patient_gender = "Gender Identity"&lt;BR /&gt;;
CARDS;
1	1	1	1	1	1	1
1	1	1	1	1	1	1
1	1	1	1	2	1	1
1	1	1	1	2	1	1
1	1	1	1	2	2	1
1	1	1	1	2	2	1
1	1	1	1	3	2	1
1	1	1	1	3	2	1
1	1	1	1	3	2	2
1	1	1	1	4	2	2
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
1	0	0	1	0	0	0
;
run;

data class3;
input arm age_cat patient_gender patient_pcp;&lt;BR /&gt;label &lt;BR /&gt;age_cat = "Age"&lt;BR /&gt;patient_pcp = "Has Primary Care Physician"&lt;BR /&gt;patient_gender = "Gender Identity"&lt;BR /&gt;;
CARDS;
1	1	1	1
1	1	1	2
1	1	1	3
1	1	2	1
1	1	2	2
1	1	2	3
1	1	3	1
1	1	3	2
1	1	3	3
1	1	4	1
1	1	4	2
1	1	4	3
1	1	5	1
1	1	5	2
1	1	5	3
1	2	1	1
1	2	1	2
1	2	1	3
1	2	2	1
1	2	2	2
1	2	2	3
1	2	3	1
1	2	3	2
1	2	3	3
1	2	4	1
1	2	4	2
1	2	4	3
1	2	5	1
1	2	5	2
1	2	5	3
1	3	1	1
1	3	1	2
1	3	1	3
1	3	2	1
1	3	2	2
1	3	2	3
1	3	3	1
1	3	3	2
1	3	3	3
1	3	4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	3
2	6	2	1
2	6	2	2
2	6	2	3
2	6	3	1
2	6	3	2
2	6	3	3
2	6	4	1
2	6	4	2
2	6	4	3
2	6	5	1
2	6	5	2
2	6	5	3
; 
run;


proc format;
	picture pctf (round) other='009.9%';
	value armfmt  1 = "Pre-"				
				  2 = "Post-"; 
	value agefmt  1 = "18-29"
				  2 = "30-39"
				  3 = "40-49"
				  4 = "50-59"
				  5 = "60-69"
				  6 = "&amp;gt;=70";
	value genderfmt 1 = "Man"
					2 = "Woman"
					3 = "Non-binary/non-conforming"
					4 = "Other"
					5 = "Decline";
	value pcpfmt  1 = "Yes"
				  2 = "No"
				  3 = "Decline";
run;

proc tabulate data = table1 classdata = class3 order=data format=20. style={bordercolor=black background=white borderwidth=1 cellwidth=80 font=("Times New Roman", 7pt,Normal)};
class arm age_cat patient_gender patient_pcp/preloadfmt ORDER=DATA s={bordercolor=black background=white borderwidth=1 cellwidth=200 font=("Times New Roman", 7pt,Bold) just=c} ;
classlev arm age_cat patient_gender patient_pcp/ s={bordercolor=black background=white borderwidth=1 cellwidth=200 font=("Times New Roman", 7pt,Bold)};
var sn q1n q2n/ s={bordercolor=black background=white borderwidth=1 font=("Times New Roman", 7pt,Bold)};
table sn (q1n)*(sum*f=best12. colpctsum&amp;lt;sn&amp;gt;*f=pctf.) (q2n)*(sum*f=best12. colpctsum&amp;lt;q1n&amp;gt;*f=pctf.) (age_cat)*(n*f=best12. colpctn&amp;lt;q2n&amp;gt;*f=pctf.) (patient_gender)*(n*f=best12. colpctn&amp;lt;q2n&amp;gt;*f=pctf.) (patient_pcp)*(n*f=best12. colpctn&amp;lt;q2n&amp;gt;*f=pctf.), arm ALL='Total' /printmiss box={s={bordercolor=black background=white borderwidth=1}};
format arm armfmt. age_cat agefmt. patient_gender genderfmt. patient_pcp pcpfmt.;
keyword all sum colpctsum colpctn n/ s={background=white font=("Times New Roman", 7pt,Bold)};
keylabel n ='N' sum='N' colpctsum = '%' colpctn = '%'; 
label arm = 'Arm';
title j=left font = "Times New Roman" 'Table 1: Patient Screening &amp;amp; Demographic Information';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The outputted table looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hr667_1-1733853170212.png" style="width: 657px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102878iAC4CE5F19D4E09DA/image-dimensions/657x859?v=v2" width="657" height="859" role="button" title="hr667_1-1733853170212.png" alt="hr667_1-1733853170212.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hr667_2-1733853199991.png" style="width: 652px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/102879iC368EF876116B61B/image-dimensions/652x44?v=v2" width="652" height="44" role="button" title="hr667_2-1733853199991.png" alt="hr667_2-1733853199991.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is close to what I want, but I would like to remove the '0' rows which represent missing. I tried setting these values to missing, but the table would then only include those who were consented i.e. remove observations from the table that had missing values and make the screened value incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also would like to add formatting to the box directly to the right of the variable labels. It is currently outputting shaded blue, and I would like to remove that to match the formatting on the rest of the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any guidance would be appreciated, thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2024 17:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/953126#M83803</guid>
      <dc:creator>hr667</dc:creator>
      <dc:date>2024-12-10T17:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PROC TABULATE Formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/954535#M83826</link>
      <description>&lt;P&gt;Probably too late, but:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Help us help you by boiling down your problem. Hundreds of figures and multiple data sets are unneeded to build a cross table and explain what you want to achieve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If you want the percentages not to reach 100%, you need to perform your custom calculations before hand and use proc tabulate to only display the results.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Dec 2024 06:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/954535#M83826</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-12-24T06:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PROC TABULATE Formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/955540#M83857</link>
      <description>&lt;P&gt;No not too late, but I only have one figure and two datasets (one of which is to just to make sure all columns/rows appear even if they're empty) . Not sure what the issue is with that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I carefully laid all of it out so that the whole thing could be run and would directly output the single table I'm asking about. The PROC TABULATE portion is where my question is, but people always ask for example data in these forums so I thought I'd supply that.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For your second point, I'm not sure what you mean. These are my questions about formatting PROC TABULATE output from my original post:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I would like to remove the '0' rows which represent missing. I tried setting these values to missing, but the table would then only include those who were consented i.e. remove observations from the table that had missing values and make the screened value incorrect.&lt;/LI&gt;&lt;LI&gt;I also would like to add formatting to the box directly to the right of the variable labels. It is currently outputting shaded blue, and I would like to remove that to match the formatting on the rest of the table.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Any help would be appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 20:38:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/955540#M83857</guid>
      <dc:creator>hr667</dc:creator>
      <dc:date>2025-01-08T20:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PROC TABULATE Formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/955807#M83858</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/439640"&gt;@hr667&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This is close to what I want, but I would like to remove the '0' rows which represent missing. I tried setting these values to missing, but the table would then only include those who were consented i.e. remove observations from the table that had missing values and make the screened value incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also would like to add formatting to the box directly to the right of the variable labels. It is currently outputting shaded blue, and I would like to remove that to match the formatting on the rest of the table.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;1.)&amp;nbsp; To remove the&amp;nbsp;'0' rows :&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;To the TABLE statement and after the forward slash ( / ) you add :&lt;BR /&gt;printmiss MISSTEXT='0' ... or just ... printmiss&lt;/LI&gt;
&lt;LI&gt;To the PROC TABULATE statement you add : out=tabulardata.&lt;/LI&gt;
&lt;LI&gt;In the&amp;nbsp;tabulardata dataset (to be found in WORK library) you can delete (programmatically with a WHERE statement) the rows you do not want to display and then run a 2nd PROC TABULATE. The 2nd PROC TABULATE is only displaying ... not summarizing / not aggregating / not calculating!&lt;BR /&gt;Make sure the screened (non-zero) values stay identical to the ones in the original table. Check this diligently.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;2.)&amp;nbsp; To get rid of the shaded blue next to the variable label :&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;&lt;SPAN&gt;Proc TABULATE does NOT have a table template like (for example) PROC FREQ and PROC MEANS.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;But the 'look' of PROC TABULATE output is impacted by the &lt;STRONG&gt;STYLE=&lt;/STRONG&gt; overrides in the procedure syntax. And you can change the style by means of a style template.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;ODS HTML, proc tabulate, proc template, how to change style?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-proc-tabulate-proc-template-how-to-change-style/td-p/160497" target="_blank"&gt;https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-HTML-proc-tabulate-proc-template-how-to-change-style/td-p/160497&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;PROC TABULATE – Building Tables with Style Michael Eberhart, MPH, Department of Public Health, Philadelphia, PA&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug10/hw/hw04.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug10/hw/hw04.pdf&lt;/A&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Ciao, Koen&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2025 14:50:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/955807#M83858</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2025-01-11T14:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with PROC TABULATE Formatting</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/962129#M83932</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Koen(@sbxkoenk),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks so much for your reply!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1) I've tried what you suggested. I've gotten to the point of removing the rows with the 0's that I don't want to display. I'm having some issues formatting the proc tabulate statement to display the outputted dataset from the first proc tabulate. Do you have any guidance on this?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2) Worked perfectly!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks again!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Mar 2025 18:31:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Help-with-PROC-TABULATE-Formatting/m-p/962129#M83932</guid>
      <dc:creator>hr667</dc:creator>
      <dc:date>2025-03-18T18:31:12Z</dc:date>
    </item>
  </channel>
</rss>

