<?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: How to create a 2x2 table with a third variable as the content of the table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962624#M375174</link>
    <description>&lt;P&gt;You need a&amp;nbsp;&lt;SPAN&gt;cross tabulation table (or crosstab) and you can easily make that with PROC REPORT.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Paper 388-2014 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sailing Over the ACROSS Hurdle in PROC REPORT &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cynthia L. Zender, SAS Institute Inc., Cary, NC&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Mar 2025 23:24:11 GMT</pubDate>
    <dc:creator>sbxkoenk</dc:creator>
    <dc:date>2025-03-25T23:24:11Z</dc:date>
    <item>
      <title>How to create a 2x2 table with a third variable as the content of the table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962619#M375173</link>
      <description>&lt;P&gt;Hi all, I don't know if my title makes any sense, but here is the issue. I have a dataset with the variables year, cause of death, race/ethnicity, and ratio. I want to create a table that is sort of like a 2x2 table by cause, except instead of having frequencies in the table, I want the ratio variable to populate the table. Like, if I have five categories for cause of death, four years, and 5 categories of race/ethnicity, I want five tables (or one big table) that look like what would be generated from this code:&lt;/P&gt;
&lt;PRE&gt;proc sort data=dataset; by cause; run;
proc freq data=dataset;
tables year*race;
by cause;
run;&lt;/PRE&gt;
&lt;P&gt;Except I would see the ratios in the table, and be able to say (for example) that the mortality ratio for NH white participants in 2012 whose cause of death was suicide is 3.5 per 100,000 (totally made up number). Is this possible, either in SAS or through exporting into Excel? I'm not sure how clear this is so please let me know if I can clarify anything. Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 20:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962619#M375173</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2025-03-25T20:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a 2x2 table with a third variable as the content of the table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962624#M375174</link>
      <description>&lt;P&gt;You need a&amp;nbsp;&lt;SPAN&gt;cross tabulation table (or crosstab) and you can easily make that with PROC REPORT.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;See :&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Paper 388-2014 &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Sailing Over the ACROSS Hurdle in PROC REPORT &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cynthia L. Zender, SAS Institute Inc., Cary, NC&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 23:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962624#M375174</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2025-03-25T23:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a 2x2 table with a third variable as the content of the table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962628#M375176</link>
      <description>&lt;P&gt;If your final desired output is a Excel file, you could try to use PROC REPORT.&lt;/P&gt;
&lt;P&gt;If you want sas dataset,that is another story.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(123);
do cause='a','b','c';
 do year=2020 to 2025;
  do race='x','y','z';
    ratio=rand('uniform');
	output;
  end;
 end;
end;
run;

options nobyline;
ods _all_ close;
ods excel file='c:\temp\want.xlsx' options(embedded_titles='yes' sheet_name='RxC ratio table' sheet_interval='none');
title "Cause: #byval1";
proc report data=have nowd;
by cause;
columns year ratio,race;
define year/group;
define race/across;
define ratio/analysis '';
run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1742951234434.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/105631iC1A2F4C0485D3382/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1742951234434.png" alt="Ksharp_0-1742951234434.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Mar 2025 01:07:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962628#M375176</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-03-26T01:07:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a 2x2 table with a third variable as the content of the table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962689#M375187</link>
      <description>THANK YOU!!!!!!</description>
      <pubDate>Wed, 26 Mar 2025 16:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-2x2-table-with-a-third-variable-as-the-content/m-p/962689#M375187</guid>
      <dc:creator>joachimg</dc:creator>
      <dc:date>2025-03-26T16:08:16Z</dc:date>
    </item>
  </channel>
</rss>

