<?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: Creating output file with multiple variables, each in its own column in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/451610#M20787</link>
    <description>&lt;P&gt;Use PROC TRANSPOSE on the&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;temp&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;results_v&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;version&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;_Def&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;defnumb&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then proc print that result.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Apr 2018 16:19:36 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-04-05T16:19:36Z</dc:date>
    <item>
      <title>Creating output file with multiple variables, each in its own column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/451607#M20786</link>
      <description>&lt;P&gt;I have several statistics that are reported for 17 case definitions that I'm testing.&amp;nbsp; I'd like to put them in a format that is easier to read and make comparisons.&amp;nbsp; The final goal is to put them together in an Excel file, but I think I can modify syntax I already have to handle that IF I can get SAS to display the output correctly.&amp;nbsp; Here is my current code, which displays the results on several rows instead of on a single row.&amp;nbsp; I'm also attaching pix of the SAS freq output and a shell of what I would like the final table to look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS TRACE ON;
DATA temp.claim_line_it_DX_def&amp;amp;defnumb._all;
	MERGE temp.claim_line_it_DX_def&amp;amp;defnumb._TP temp.claim_line_it_DX_def&amp;amp;defnumb._FP
		temp.claim_line_it_DX_def&amp;amp;defnumb._FN temp.claim_line_it_DX_def&amp;amp;defnumb._TN
		temp.claim_line_it_DX_def&amp;amp;defnumb._Excl;
	BY ROWID;
	
Sensitivity = TP_count / (TP_count + FN_count);
Specificity = TN_count / (TN_count + FP_count);
Area_under_curve = (Sensitivity + Specificity)/2;

title1 "Case Definition &amp;amp;defnumb. - A count of at least 1 SCA claim (D5700, D5701, D5702)(Version &amp;amp;version.)";
PROC FREQ;
	TABLES TP_count FP_count FN_count TN_count Excl_count Sensitivity Specificity
			Area_under_curve;

ODS OUTPUT OneWayFreqs(match_all)=temp.results_v&amp;amp;version._Def&amp;amp;defnumb.;
PROC FREQ DATA = temp.claim_line_it_DX_def&amp;amp;defnumb._all;
	TABLES TP_count FP_count FN_count TN_count Excl_count Sensitivity Specificity
			Area_under_curve;
RUN;

ODS LISTING;
PROC PRINT DATA = temp.results_v&amp;amp;version._Def&amp;amp;defnumb.;
RUN;

ODS TRACE OFF;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASfreq example.jpg" style="width: 507px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19652iB8FF1E7341200DFF/image-size/large?v=v2&amp;amp;px=999" role="button" title="SASfreq example.jpg" alt="SASfreq example.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Excel output example.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19653i39E691A0F3540274/image-size/large?v=v2&amp;amp;px=999" role="button" title="Excel output example.jpg" alt="Excel output example.jpg" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/451607#M20786</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2018-04-05T16:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating output file with multiple variables, each in its own column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/451610#M20787</link>
      <description>&lt;P&gt;Use PROC TRANSPOSE on the&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;temp&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;results_v&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;version&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;_Def&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;defnumb&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And then proc print that result.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 16:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/451610#M20787</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-05T16:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating output file with multiple variables, each in its own column</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/453614#M20817</link>
      <description>&lt;P&gt;Thanks!&amp;nbsp; Proc Transpose sent me in the right direction, but I had to play with it a bit to get the proper output.&amp;nbsp; Here is the final section of code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro defmerge (defnumbm,defname);
%let version=9;

title1 "Def&amp;amp;defnumbm. &amp;amp;defname.";

ODS TRACE ON;
ODS OUTPUT OneWayFreqs(match_all)=temp.results_v&amp;amp;version._Def&amp;amp;defnumbm.;
RUN;

PROC TRANSPOSE DATA = temp.claim_line_it_DX_Def&amp;amp;defnumbm._all out = temp.results_v&amp;amp;version._Def&amp;amp;defnumbm._t;

PROC TRANSPOSE DATA = temp.results_v&amp;amp;version._Def&amp;amp;defnumbm._t out = temp.results_v&amp;amp;version._Def&amp;amp;defnumbm.(DROP=_NAME_);

ODS LISTING;
PROC PRINT DATA = temp.results_v&amp;amp;version._Def&amp;amp;defnumbm. ;
RUN;

ODS TRACE OFF;

%mend;
%defmerge(1, - A count of at least 1 SCA claim)
%defmerge(2, - A count of at least 2 SCA claims)
%defmerge(3, - A count of at least 3 SCA claims)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:34:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Creating-output-file-with-multiple-variables-each-in-its-own/m-p/453614#M20817</guid>
      <dc:creator>Wolverine</dc:creator>
      <dc:date>2018-04-12T15:34:41Z</dc:date>
    </item>
  </channel>
</rss>

