<?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: Need to run this macro but I have 600 variables (var1, var2.... var600) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324845#M72146</link>
    <description>&lt;P&gt;thanks so much. &amp;nbsp;this solves this issue. &amp;nbsp;Much appreciated!&lt;/P&gt;</description>
    <pubDate>Sun, 15 Jan 2017 00:26:26 GMT</pubDate>
    <dc:creator>rykwong</dc:creator>
    <dc:date>2017-01-15T00:26:26Z</dc:date>
    <item>
      <title>Need to run this macro but I have 600 variables (var1, var2.... var600)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324026#M71875</link>
      <description>&lt;P&gt;Dear SAS community&lt;/P&gt;
&lt;P&gt;I was given this macro which is useful to use but it only runs it for var1. &amp;nbsp;I need to repeat this for all 600 variables (var1, var2, var3... ...var600) in a dataset. &amp;nbsp; Each of var1, var2....var600 is a column of data in the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My purpose of running this macro is to extract the name of the dependent variables, name of the variable (i.e. var1), and the P-value of the interaction term (drug*var1). &amp;nbsp;Is there a way to automate this? &amp;nbsp;Many thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods graphics&lt;SPAN&gt; / &lt;/SPAN&gt;reset&lt;SPAN&gt;=&lt;/SPAN&gt;all&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;I&gt;loop&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;data pv2_var1;&lt;/P&gt;
&lt;P&gt;format y &lt;SPAN&gt;$20.&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt; endpoint=d_lvef ln_lvesvi d_globalecvrem ln_ecv_rem d_total_lge_fw ln_total_lge_fw;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%do&lt;/SPAN&gt; i=&lt;SPAN&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;%to&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;6&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%let&lt;/SPAN&gt; y=&lt;SPAN&gt;%scan&lt;/SPAN&gt;(&amp;amp;endpoint,&amp;amp;i,' ');&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;title &lt;/SPAN&gt;"Endpoint = &amp;amp;y"&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ODS OUTPUT SOLUTIONF=RESULTS;&lt;/P&gt;
&lt;P&gt;proc mixed data=testset covtest noclprint plots=studentpanel method=reml;&lt;/P&gt;
&lt;P&gt;class patient_id site_id;&lt;/P&gt;
&lt;P&gt;model0: model &amp;amp;y = drug var1&amp;nbsp;drug*var1/ s cl ddfm=kenwardroger;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;DATA pv2_var1;&lt;/P&gt;
&lt;P&gt;SET pv2_var1 RESULTS(IN=A);&lt;/P&gt;
&lt;P&gt;if missing(effect) then delete;&lt;/P&gt;
&lt;P&gt;IF A THEN Y=&lt;SPAN&gt;"&amp;amp;y"&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%end&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;title &lt;SPAN&gt;" "&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;loop&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 19:05:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324026#M71875</guid>
      <dc:creator>rykwong</dc:creator>
      <dc:date>2017-01-11T19:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Need to run this macro but I have 600 variables (var1, var2.... var600)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324101#M71918</link>
      <description>&lt;P&gt;What is it that you want to automate, that isn't already automated?&amp;nbsp; How to get a list of 600 variable names?&amp;nbsp; The rest looks pretty well automated except for one piece.&amp;nbsp; The final DATA step should be replaced with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data results;&lt;/P&gt;
&lt;P&gt;set results;&lt;/P&gt;
&lt;P&gt;length y $ 32;&lt;/P&gt;
&lt;P&gt;y = "&amp;amp;y";&lt;/P&gt;
&lt;P&gt;if missing(effect) then delete;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc append data=results base=pv2_var1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2017 22:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324101#M71918</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-11T22:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need to run this macro but I have 600 variables (var1, var2.... var600)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324122#M71924</link>
      <description>&lt;P&gt;thanks. &amp;nbsp;I needed to run 600 variables, so instead of var1, run the macro with var2, then var3..... all the way to var600. &amp;nbsp;Note that var1, var2 ...etc are just names for the purpose of discussion, the variables have read names and they are not patterned. &amp;nbsp;There are also variable columns that are not a part of the 600 in between these 600 variables in the list (although I can remove them)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;many thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 00:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324122#M71924</guid>
      <dc:creator>rykwong</dc:creator>
      <dc:date>2017-01-12T00:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need to run this macro but I have 600 variables (var1, var2.... var600)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324139#M71931</link>
      <description>&lt;P&gt;&lt;A href="http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/" target="_blank"&gt;http://www.ats.ucla.edu/stat/sas/seminars/sas_macros_introduction/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you make your macro more generic, to take a parameter that's the variable name then you can query the DICTIONARY.COLUMNS table to get a variable list. Then you can use CALL EXECUTE to execute the macro for each variable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 02:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324139#M71931</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-12T02:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need to run this macro but I have 600 variables (var1, var2.... var600)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324845#M72146</link>
      <description>&lt;P&gt;thanks so much. &amp;nbsp;this solves this issue. &amp;nbsp;Much appreciated!&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jan 2017 00:26:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-run-this-macro-but-I-have-600-variables-var1-var2-var600/m-p/324845#M72146</guid>
      <dc:creator>rykwong</dc:creator>
      <dc:date>2017-01-15T00:26:26Z</dc:date>
    </item>
  </channel>
</rss>

