<?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: Run regressions with different dependent variables in a macro in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479268#M24932</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods exclude all;
ods output parameterEstimates = want;
proc reg data=sashelp.class;
model weight height = age;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The model statement can hold multiple variables as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My only concern with doing this is if you have missing data and want to selectively include records. If you have no missing data this is not an issue.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jul 2018 20:41:14 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-07-18T20:41:14Z</dc:date>
    <item>
      <title>Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479169#M24927</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the following code, my dependent variables are Age, Height and Weight. My only one independent variable is Gender. I want to run the regressions by id and then store the estimates of the regressions (with different dependent variables) in one file.&lt;/P&gt;&lt;P&gt;The following code works except that for some of the ids, DF is 0 and the estimates are also 0. When I run the regressions without a loop, for each dependent variable separately (with the same dataset), DF is never 1. Can you help me saying what is wrong with my code?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = DataSET out= DataSET; 
by id; 
run;


%let dvar = Age Height Weight;
%let N = %sysfunc(countw(&amp;amp;dvar));


%macro reg; /* macro to create regression estimates in one table */
proc datasets nolist lib=work;
delete&amp;nbsp;Merged&amp;nbsp;Each_var;
run;
proc sort data=DataSET; by id; run;

%do i=1 %to &amp;amp;N;
%let var = %scan(&amp;amp;dvar, &amp;amp;i);
ods exclude all;
ods output ParameterEstimates = Each_&amp;amp;var;
proc reg data = DataSET;
by id;
model &amp;amp;dvar = Gender; run;
proc datasets lib=work;
append base=Merged data=Each_&amp;amp;var FORCE; run;
%end;
%mend;
%reg;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 17:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479169#M24927</guid>
      <dc:creator>fafrin420</dc:creator>
      <dc:date>2018-07-18T17:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479175#M24928</link>
      <description>&lt;P&gt;Can you show the code that works for comparison?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 18:03:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479175#M24928</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-18T18:03:27Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479177#M24929</link>
      <description>&lt;P&gt;Honestly why even use a macro here at all? PROC REG can handle multiple dependent variables and output the results to a single data set in one run of PROC REG. I think you are making your life difficult by using macros.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 19:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479177#M24929</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-18T19:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479267#M24931</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Honestly why even use a macro here at all? PROC REG can handle multiple dependent variables and output the results to a single data set in one run of PROC REG. I think you are making your life difficult by using macros.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And use the Label: option on the model statement to make the results easier to use/read.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 20:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479267#M24931</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-18T20:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479268#M24932</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods exclude all;
ods output parameterEstimates = want;
proc reg data=sashelp.class;
model weight height = age;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The model statement can hold multiple variables as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My only concern with doing this is if you have missing data and want to selectively include records. If you have no missing data this is not an issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 20:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479268#M24932</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-18T20:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479295#M24933</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;The model statement can hold multiple variables as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My only concern with doing this is if you have missing data and want to selectively include records. If you have no missing data this is not an issue.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is probably the original problem, due to miscoding.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 21:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479295#M24933</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-18T21:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479302#M24934</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, &lt;STRONG&gt;proc glm&lt;/STRONG&gt; goes into "MANOVA mode" only if you specify option MANOVA in the proc statement or use a MANOVA statement. Otherwise, the procedure analyses each dependent variable&amp;nbsp;using all available data.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 21:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479302#M24934</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-07-18T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479305#M24935</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;, &lt;STRONG&gt;proc glm&lt;/STRONG&gt; goes into "MANOVA mode" only if you specify option MANOVA in the proc statement or use a MANOVA statement. Otherwise, the procedure analyses each dependent variable&amp;nbsp;using all available data.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;, this user was using PROC REG. What does PROC REG do? I suspect if any Y is missing, then the observation isn't used, most likely the original problem due to miscoding.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jul 2018 22:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479305#M24935</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-07-18T22:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Run regressions with different dependent variables in a macro</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479311#M24937</link>
      <description>&lt;P&gt;Tested this, PROC GLM does include all data when available, where PROC REG excludes any row with missing data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So PROC GLM will avoid that issue entirely, which is good to know! Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title 'Two at once';
proc glm data=class;
model weight height = age;
run;


title 'Weight regression';
ods output parameterestimates;
proc glm data=class;
model weight  = age;
run;

title 'Height regression';
ods output parameterestimates;
proc glm data=class;
model height  = age;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Jul 2018 22:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Run-regressions-with-different-dependent-variables-in-a-macro/m-p/479311#M24937</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-18T22:50:06Z</dc:date>
    </item>
  </channel>
</rss>

