<?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: Merge Outputs in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401916#M3617</link>
    <description>&lt;P&gt;Is there a particular reason you're running one variable at a time through all these procedures? Why not do them all at once?&lt;/P&gt;</description>
    <pubDate>Fri, 06 Oct 2017 20:16:31 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-10-06T20:16:31Z</dc:date>
    <item>
      <title>Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401867#M3610</link>
      <description>&lt;P&gt;Hey!&lt;BR /&gt;&lt;BR /&gt;I'm writing a macro and my current output looks like this:&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas.png" style="width: 338px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15678iF5579234C6B7EC30/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas.png" alt="sas.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;I'd like to merge those two so that my output looks like this:&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15679i05F3855149A5F1FD/image-dimensions/600x19?v=v2" width="600" height="19" role="button" title="sas2.png" alt="sas2.png" /&gt;&lt;/span&gt;&lt;BR /&gt;This is what my code currently looks like:&lt;BR /&gt;The words macro counts the number of variables in vars_icf&lt;/P&gt;&lt;PRE&gt;&lt;BR /&gt;%LET M=%WORDS(&amp;amp;vars_icf.);&lt;BR /&gt;%Do i=1 %TO &amp;amp;M.;&lt;BR /&gt;%Let var1 = %scan (&amp;amp;vars_icf., &amp;amp;i.);&lt;BR /&gt;ODS Output summary=output1 (Rename=(&amp;amp;var._N = N &amp;amp;var._NMISS = NMiss));&lt;BR /&gt;proc means data=&amp;amp;input. N NMISS;&lt;BR /&gt;var &amp;amp;var1.;&lt;BR /&gt;run;&lt;BR /&gt;ods output close;&lt;BR /&gt;ODS Output summary=test;&lt;BR /&gt;proc freq data=&amp;amp;input.;&lt;BR /&gt;tables &amp;amp;var1. / NOCUM;&lt;BR /&gt;run;&lt;BR /&gt;ods output close;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I am grateful for any help!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 18:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401867#M3610</guid>
      <dc:creator>nhi996</dc:creator>
      <dc:date>2017-10-06T18:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401870#M3611</link>
      <description>&lt;P&gt;Please post your whole code. The macro definition (%macro and %mend, for %do to work) is missing, as the macro call that activates all this. And I see no %end for the %do.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 18:27:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401870#M3611</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-06T18:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401875#M3612</link>
      <description>&lt;P&gt;Ok I added a bit.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO ICF(vars_icf=, vars_cor=, input=, output=);
%LET M=%WORDS(&amp;amp;vars_icf.);
%DO i=1 %TO &amp;amp;M.;
%Let var1 = %scan (&amp;amp;vars_icf., &amp;amp;i.);
%Let var2 = %scan(&amp;amp;vars_cor., &amp;amp;i.);
ODS Output summary=output1 (RENAME=(&amp;amp;var1._N = N &amp;amp;var1._NMISS = NMiss)); 
proc means data=&amp;amp;input. N NMISS;
var &amp;amp;var1.;
run;
ods output close;
data output 1_1;
set output1;
format variablenname $20.;
variablenname = "&amp;amp;vars_icf.";
run;
ods output summary=output2;
proc freq data=&amp;amp;input.;
tables &amp;amp;var1. / NOCUM;
run;
ods output close;
set output1;
ods output summary=test2;
proc corr data=&amp;amp;input. PEARSON NOMISS NOPROB NOSIMPLE;
var &amp;amp;var1.;
with &amp;amp;vars_cor.;
ods output close;
data output3_1;
set test2;
%END;
%MEND icf;


%icf(input=multiple_sclerosis, vars_cor=eq5d, vars_icf=d530);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I want to do the following with this macro:&lt;BR /&gt;The vars_icf all can be between 0 and 4. So each row stands for 1 variable (d530, d540...) and in the columns, for each var I want&amp;nbsp;&lt;BR /&gt;N, NMiss, the absolute and relative frequency and the correlations with the variables&amp;nbsp; of vars_cor.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 18:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401875#M3612</guid>
      <dc:creator>nhi996</dc:creator>
      <dc:date>2017-10-06T18:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401878#M3613</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sas2.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15681i3325F5755EC8442F/image-size/large?v=v2&amp;amp;px=999" role="button" title="sas2.png" alt="sas2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is how my preferred output should look like.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 18:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401878#M3613</guid>
      <dc:creator>nhi996</dc:creator>
      <dc:date>2017-10-06T18:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401916#M3617</link>
      <description>&lt;P&gt;Is there a particular reason you're running one variable at a time through all these procedures? Why not do them all at once?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 20:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401916#M3617</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-06T20:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401918#M3618</link>
      <description>No. I'm fairly new to sas and not used to the style of programming yet</description>
      <pubDate>Fri, 06 Oct 2017 20:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401918#M3618</guid>
      <dc:creator>nhi996</dc:creator>
      <dc:date>2017-10-06T20:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401920#M3619</link>
      <description>&lt;P&gt;If you're new to SAS, I wouldn't start with macros. There's a lot of 'newer' ways to do things that are a lot more efficient. You can run all variables at once through proc means and proc freq.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 20:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401920#M3619</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-06T20:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Merge Outputs</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401939#M3620</link>
      <description>&lt;P&gt;It's a worksheet for university and we have to use a macro unfortunately&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 20:40:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Merge-Outputs/m-p/401939#M3620</guid>
      <dc:creator>nhi996</dc:creator>
      <dc:date>2017-10-06T20:40:43Z</dc:date>
    </item>
  </channel>
</rss>

