<?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: Mixed models macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617738#M181074</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/307201"&gt;@Polina_UH&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1nhhymw6gxixvn1johcfl6kaygw.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;%SCAN function&lt;/A&gt; to extract the individual biomarker names, one at a time, from your macro variable and use the results in the MODEL statement:&lt;/P&gt;
&lt;PRE&gt;%macro mixed;
&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;%local i biom;

%do i=1 %to %sysfunc(countw(&amp;amp;biomarker));
  %let biom=%scan(&amp;amp;biomarker, &amp;amp;i);
&lt;/STRONG&gt;&lt;/FONT&gt;
  proc mixed data=met method=ML;
  class final_id bmi_cat;
  model &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;&amp;amp;biom&lt;/FONT&gt;&lt;/STRONG&gt; = bmi_cat gw cohort/ solution ddfm=satterthwaite cl alpha=0.001;
  random intercept time/ subject=final_id type=un;
  repeated /subject=final_id type=ar(1);
  run;

&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;%end;&lt;/STRONG&gt;&lt;/FONT&gt;
%mend mixed;&lt;/PRE&gt;
&lt;P&gt;&lt;STRIKE&gt;Also, note that a multivariate analysis (with more than one dependent variable, as you did it with PROC GLM) is not just an abbreviated way to conduct several univariate analyses.&lt;/STRIKE&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Jan 2020 14:04:43 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-01-16T14:04:43Z</dc:date>
    <item>
      <title>Mixed models macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617732#M181069</link>
      <description>&lt;P&gt;Dear SAS experts, may I ask for your help again...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to run mixed models with hundreds of metabolites as the outcomes. I created this macro variable:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;193 %put &amp;amp;biomarker;&lt;BR /&gt;XXLVLDLP XXLVLDLL XXLVLDLPL XXLVLDLC XXLVLDLCE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc mixed for each of the metabolites individually works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc mixed data=met method=ML;&lt;BR /&gt;class final_id bmi_cat;&lt;BR /&gt;model XXLVLDLP=bmi_cat gw cohort/ solution ddfm=satterthwaite cl alpha=0.001;&lt;BR /&gt;random intercept time/ subject=final_id type=un;&lt;BR /&gt;repeated /subject=final_id type=ar(1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Macro for proc glm works too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro glm;&lt;BR /&gt;proc glm data=met;&lt;BR /&gt;model &amp;amp;biomarker=maternal_age/ clparm noint;&lt;BR /&gt;ods output ParameterEstimates=dPara; quit;&lt;BR /&gt;run;&lt;BR /&gt;%mend glm;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try to run this macro for proc mixed&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro mixed;&lt;BR /&gt;proc mixed data=met method=ML;&lt;BR /&gt;class final_id bmi_cat;&lt;BR /&gt;model &amp;amp;biomarker = bmi_cat gw cohort/ solution ddfm=satterthwaite cl alpha=0.001;&lt;BR /&gt;random intercept time/ subject=final_id type=un;&lt;BR /&gt;repeated /subject=final_id type=ar(1);&lt;BR /&gt;run;&lt;BR /&gt;%mend mixed;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it gives me this mistake&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 proc mixed data=met method=ML; class final_id bmi_cat; model &amp;amp;biomarker = bmi_cat gw&lt;BR /&gt;-&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;1 ! cohort/ solution ddfm=satterthwaite cl alpha=0.001; random intercept time/ subject=final_id&lt;BR /&gt;1 ! type=un; repeated /subject=final_id type=ar(1); ods output solutionf=a; run;&lt;BR /&gt;NOTE: Line generated by the macro variable "BIOMARKER".&lt;BR /&gt;1 XXLVLDLP XXLVLDLL XXLVLDLPL XXLVLDLC XXLVLDLCE&lt;BR /&gt;--------&lt;BR /&gt;73&lt;/P&gt;&lt;P&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, *, -, /, :, @,&lt;BR /&gt;_CHARACTER_, _CHAR_, _NUMERIC_, |.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appreciate if you could let me know what I'm doing wrong...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 12:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617732#M181069</guid>
      <dc:creator>Polina_UH</dc:creator>
      <dc:date>2020-01-16T12:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617735#M181071</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_mixed_syntax10.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;documentation of The Mixed Procedure&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;H3 class="xis-title"&gt;MODEL Statement&lt;/H3&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="statug_mixed003176" class="aa-statementblock"&gt;
&lt;UL class="aa-statementblock"&gt;
&lt;LI&gt;
&lt;P&gt;&lt;SPAN class="aa-statement"&gt;MODEL&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="aa-statementoptional"&gt;dependent&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=" aa-keyword"&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;fixed-effects&amp;gt; &amp;lt;/ options&amp;gt;&lt;/SPAN&gt;;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The MODEL statement names a &lt;STRONG&gt;single&lt;/STRONG&gt; dependent variable and the fixed effects, which determine the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;matrix of the mixed model (see the section&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_mixed_details13.htm&amp;amp;locale=de" data-docset-id="statug" data-docset-version="15.1" data-original-href="statug_mixed_details13.htm"&gt;Parameterization of Mixed Models&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for details). The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A tabindex="0" href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=statug&amp;amp;docsetTarget=statug_glm_details02.htm&amp;amp;locale=de" data-docset-id="statug" data-docset-version="15.1" data-original-href="statug_glm_details02.htm"&gt;specification of effects&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is the same as in the GLM procedure; however, unlike PROC GLM, you do not specify random effects in the MODEL statement. The MODEL statement is required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(emphasis by me)&lt;/P&gt;
&lt;P&gt;You cannot use more than one dependent variable in the model statement of proc mixed.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 12:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617735#M181071</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-01-16T12:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617737#M181073</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 12:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617737#M181073</guid>
      <dc:creator>Polina_UH</dc:creator>
      <dc:date>2020-01-16T12:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617738#M181074</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/307201"&gt;@Polina_UH&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the &lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1nhhymw6gxixvn1johcfl6kaygw.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank" rel="noopener"&gt;%SCAN function&lt;/A&gt; to extract the individual biomarker names, one at a time, from your macro variable and use the results in the MODEL statement:&lt;/P&gt;
&lt;PRE&gt;%macro mixed;
&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;%local i biom;

%do i=1 %to %sysfunc(countw(&amp;amp;biomarker));
  %let biom=%scan(&amp;amp;biomarker, &amp;amp;i);
&lt;/STRONG&gt;&lt;/FONT&gt;
  proc mixed data=met method=ML;
  class final_id bmi_cat;
  model &lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;&amp;amp;biom&lt;/FONT&gt;&lt;/STRONG&gt; = bmi_cat gw cohort/ solution ddfm=satterthwaite cl alpha=0.001;
  random intercept time/ subject=final_id type=un;
  repeated /subject=final_id type=ar(1);
  run;

&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;%end;&lt;/STRONG&gt;&lt;/FONT&gt;
%mend mixed;&lt;/PRE&gt;
&lt;P&gt;&lt;STRIKE&gt;Also, note that a multivariate analysis (with more than one dependent variable, as you did it with PROC GLM) is not just an abbreviated way to conduct several univariate analyses.&lt;/STRIKE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 14:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617738#M181074</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-01-16T14:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mixed models macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617742#M181075</link>
      <description>&lt;P&gt;Thank you so much, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt;&amp;nbsp;, it worked!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 12:47:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Mixed-models-macro/m-p/617742#M181075</guid>
      <dc:creator>Polina_UH</dc:creator>
      <dc:date>2020-01-16T12:47:50Z</dc:date>
    </item>
  </channel>
</rss>

