<?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 Do loop for multiple dependent variables in proc glimmix in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776279#M246841</link>
    <description>&lt;P&gt;Hi Everyone! I am having some difficulty with creating a functioning do loop to run proc glimmix with multiple dependent and independent variables. I have 9 dependent variables that I want to run 1 by 1 in proc glimmix against all of my predictor variables. I tried following these instructions&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html" target="_blank" rel="noopener"&gt;An easy way to run thousands of regressions in SAS - The DO Loop&lt;/A&gt;, however, it only works for my predictor variables. For my dependent variable it will only run the very first outcome which is trouble sleeping. Am I do something wrong, or is it just not possible to have SAS run multiple glimmix functions with different dependent variables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help!!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data perm.temp; 
 set perm.mentalhealth; 
 array var_list[9] trouble_sleeping hurting_yourself interest depressed little_energy appetite feeling_bad concentrating
 moving_slowly;
 array categorical[22]  gender age scalp_lesions postauricular erythema eyelid_involvement cheilitis flexural_erythema xerosis neck_folds nipple_eczema
keratosis palmar hand_eczema ichthyosis foot_eczema race education_final insurance alopecia pityriasis pain;
array npredictors[9] SCORAD EASI BSA ADSI POEM_SCORE dlqi_score FIVED_SCORE RL_SCORE flare;
  do i=1 to dim(var_list);
  VarName=vname(var_list(i));
Outcome=var_list[i];
 do j=1 to dim(categorical);
categorical_=vvalue(categorical(j));
do i=1 to dim(npredictors);
npredictors_=vname(npredictors(i));
format Depression Depressionn. Anxiety Anxietyy. interest interestt. depressed _depressedd. trouble_sleeping trouble_sleepingg. little_energy little_energyy. appetite appetitee.
feeling_bad feeling_badd. concentrating concentratingg. moving_slowly moving_slowlyy. hurting_yourself hurting_yourselff. PHQ9_SCORE PHQ9_SCORE_. PHQ2_SCORE PHQ2_SCORE.
 gender gender. race race. education_final education. insurance insurance. scalp_lesions scalp_lesionss. postauricular postauricularr. erythema erythemaa. eyelid_involvement eyelid_involvementt.
cheilitis cheilitiss. flexural_erythema flexural_erythemaa. xerosis xerosiss. neck_folds neck_foldss. nipple_eczema nipple_eczemaa. keratosis keratosiss. palmar palmarr. hand_eczema hand_eczemaa. ichthyosis ichthyosiss.
foot_eczema foot_eczemaa. age age_bin_. alopecia alopeciaa. pityriasis pityriasiss. pain painn. ;
 output;
end; end; end;
run; 
 proc print data=perm.temp; 
 run;
 proc sort data=perm.temp; by VarName; run;
proc glimmix data=perm.temp method=laplace order=internal; 
by VarName;
 class  record_id_final  npredictors_ categorical_;
 model outcome = npredictors_ categorical_ /link=cumlogit dist=multinomial solution;
  random visit /subject=record_id_final;
  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;LOG:&lt;BR /&gt;292  data perm.temp;
293   set perm.mentalhealth;
294   array var_list[9] trouble_sleeping hurting_yourself interest depressed little_energy appetite
294! feeling_bad concentrating
295   moving_slowly;
296   array categorical[22]  gender age scalp_lesions postauricular erythema eyelid_involvement
296! cheilitis flexural_erythema xerosis neck_folds nipple_eczema
297  keratosis palmar hand_eczema ichthyosis foot_eczema race education_final insurance alopecia
297! pityriasis pain;
298  array npredictors[9] SCORAD EASI BSA ADSI POEM_SCORE dlqi_score FIVED_SCORE RL_SCORE flare;
299    do i=1 to dim(var_list);
300    VarName=vname(var_list(i));
301  Outcome=var_list[i];
302   do j=1 to dim(categorical);
303  categorical_=vvalue(categorical(j));
304  do i=1 to dim(npredictors);
305  npredictors_=vname(npredictors(i));
306  format Depression Depressionn. Anxiety Anxietyy. interest interestt. depressed _depressedd.
306! trouble_sleeping trouble_sleepingg. little_energy little_energyy. appetite appetitee.
307  feeling_bad feeling_badd. concentrating concentratingg. moving_slowly moving_slowlyy.
307! hurting_yourself hurting_yourselff. PHQ9_SCORE PHQ9_SCORE_. PHQ2_SCORE PHQ2_SCORE.
308   gender gender. race race. education_final education. insurance insurance. scalp_lesions
308! scalp_lesionss. postauricular postauricularr. erythema erythemaa. eyelid_involvement
308! eyelid_involvementt.
309  cheilitis cheilitiss. flexural_erythema flexural_erythemaa. xerosis xerosiss. neck_folds
309! neck_foldss. nipple_eczema nipple_eczemaa. keratosis keratosiss. palmar palmarr. hand_eczema
309! hand_eczemaa. ichthyosis ichthyosiss.
310  foot_eczema foot_eczemaa. age age_bin_. alopecia alopeciaa. pityriasis pityriasiss. pain painn. ;
311   output;
312  end; end; end;
313  run;

NOTE: There were 950 observations read from the data set PERM.MENTALHEALTH.
NOTE: The data set PERM.TEMP has 188100 observations and 101 variables.
NOTE: DATA statement used (Total process time):
      real time           0.18 seconds
      cpu time            0.18 seconds


314   proc sort data=perm.temp; by VarName; run;

NOTE: There were 188100 observations read from the data set PERM.TEMP.
NOTE: The data set PERM.TEMP has 188100 observations and 101 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.34 seconds
      cpu time            0.50 seconds



315  proc glimmix data=perm.temp method=laplace order=internal;
316  by VarName;
317   class  record_id_final  npredictors_ categorical_;
318   model outcome = npredictors_ categorical_ /link=cumlogit dist=multinomial solution;
319    random visit /subject=record_id_final;
320    run;



NOTE: Some observations are not used in the analysis because of: missing response values (n=16038),
      missing fixed effects (n=9), missing subject effects (n=6534).
NOTE: The GLIMMIX procedure is modeling the probabilities of levels of Outcome having lower Ordered
      Values in the Response Profile table.
NOTE: Convergence criterion (FCONV=2.220446E-16) satisfied.
NOTE: At least one element of the (projected) gradient is greater than 1e-3.
NOTE: The above message was for the following BY group:
      VarName=trouble_sleeping
NOTE: PROCEDURE GLIMMIX used (Total process time):
      real time           2:55.20
      cpu time            2:54.98





&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schatr2_0-1635190237910.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65013iFD81BC3F5D58E804/image-size/medium?v=v2&amp;amp;px=400" role="button" title="schatr2_0-1635190237910.png" alt="schatr2_0-1635190237910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schatr2_1-1635190270931.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65014iAF4961FA80096EFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="schatr2_1-1635190270931.png" alt="schatr2_1-1635190270931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Oct 2021 19:32:21 GMT</pubDate>
    <dc:creator>393310</dc:creator>
    <dc:date>2021-10-25T19:32:21Z</dc:date>
    <item>
      <title>Do loop for multiple dependent variables in proc glimmix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776279#M246841</link>
      <description>&lt;P&gt;Hi Everyone! I am having some difficulty with creating a functioning do loop to run proc glimmix with multiple dependent and independent variables. I have 9 dependent variables that I want to run 1 by 1 in proc glimmix against all of my predictor variables. I tried following these instructions&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html" target="_blank" rel="noopener"&gt;An easy way to run thousands of regressions in SAS - The DO Loop&lt;/A&gt;, however, it only works for my predictor variables. For my dependent variable it will only run the very first outcome which is trouble sleeping. Am I do something wrong, or is it just not possible to have SAS run multiple glimmix functions with different dependent variables?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help!!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data perm.temp; 
 set perm.mentalhealth; 
 array var_list[9] trouble_sleeping hurting_yourself interest depressed little_energy appetite feeling_bad concentrating
 moving_slowly;
 array categorical[22]  gender age scalp_lesions postauricular erythema eyelid_involvement cheilitis flexural_erythema xerosis neck_folds nipple_eczema
keratosis palmar hand_eczema ichthyosis foot_eczema race education_final insurance alopecia pityriasis pain;
array npredictors[9] SCORAD EASI BSA ADSI POEM_SCORE dlqi_score FIVED_SCORE RL_SCORE flare;
  do i=1 to dim(var_list);
  VarName=vname(var_list(i));
Outcome=var_list[i];
 do j=1 to dim(categorical);
categorical_=vvalue(categorical(j));
do i=1 to dim(npredictors);
npredictors_=vname(npredictors(i));
format Depression Depressionn. Anxiety Anxietyy. interest interestt. depressed _depressedd. trouble_sleeping trouble_sleepingg. little_energy little_energyy. appetite appetitee.
feeling_bad feeling_badd. concentrating concentratingg. moving_slowly moving_slowlyy. hurting_yourself hurting_yourselff. PHQ9_SCORE PHQ9_SCORE_. PHQ2_SCORE PHQ2_SCORE.
 gender gender. race race. education_final education. insurance insurance. scalp_lesions scalp_lesionss. postauricular postauricularr. erythema erythemaa. eyelid_involvement eyelid_involvementt.
cheilitis cheilitiss. flexural_erythema flexural_erythemaa. xerosis xerosiss. neck_folds neck_foldss. nipple_eczema nipple_eczemaa. keratosis keratosiss. palmar palmarr. hand_eczema hand_eczemaa. ichthyosis ichthyosiss.
foot_eczema foot_eczemaa. age age_bin_. alopecia alopeciaa. pityriasis pityriasiss. pain painn. ;
 output;
end; end; end;
run; 
 proc print data=perm.temp; 
 run;
 proc sort data=perm.temp; by VarName; run;
proc glimmix data=perm.temp method=laplace order=internal; 
by VarName;
 class  record_id_final  npredictors_ categorical_;
 model outcome = npredictors_ categorical_ /link=cumlogit dist=multinomial solution;
  random visit /subject=record_id_final;
  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;LOG:&lt;BR /&gt;292  data perm.temp;
293   set perm.mentalhealth;
294   array var_list[9] trouble_sleeping hurting_yourself interest depressed little_energy appetite
294! feeling_bad concentrating
295   moving_slowly;
296   array categorical[22]  gender age scalp_lesions postauricular erythema eyelid_involvement
296! cheilitis flexural_erythema xerosis neck_folds nipple_eczema
297  keratosis palmar hand_eczema ichthyosis foot_eczema race education_final insurance alopecia
297! pityriasis pain;
298  array npredictors[9] SCORAD EASI BSA ADSI POEM_SCORE dlqi_score FIVED_SCORE RL_SCORE flare;
299    do i=1 to dim(var_list);
300    VarName=vname(var_list(i));
301  Outcome=var_list[i];
302   do j=1 to dim(categorical);
303  categorical_=vvalue(categorical(j));
304  do i=1 to dim(npredictors);
305  npredictors_=vname(npredictors(i));
306  format Depression Depressionn. Anxiety Anxietyy. interest interestt. depressed _depressedd.
306! trouble_sleeping trouble_sleepingg. little_energy little_energyy. appetite appetitee.
307  feeling_bad feeling_badd. concentrating concentratingg. moving_slowly moving_slowlyy.
307! hurting_yourself hurting_yourselff. PHQ9_SCORE PHQ9_SCORE_. PHQ2_SCORE PHQ2_SCORE.
308   gender gender. race race. education_final education. insurance insurance. scalp_lesions
308! scalp_lesionss. postauricular postauricularr. erythema erythemaa. eyelid_involvement
308! eyelid_involvementt.
309  cheilitis cheilitiss. flexural_erythema flexural_erythemaa. xerosis xerosiss. neck_folds
309! neck_foldss. nipple_eczema nipple_eczemaa. keratosis keratosiss. palmar palmarr. hand_eczema
309! hand_eczemaa. ichthyosis ichthyosiss.
310  foot_eczema foot_eczemaa. age age_bin_. alopecia alopeciaa. pityriasis pityriasiss. pain painn. ;
311   output;
312  end; end; end;
313  run;

NOTE: There were 950 observations read from the data set PERM.MENTALHEALTH.
NOTE: The data set PERM.TEMP has 188100 observations and 101 variables.
NOTE: DATA statement used (Total process time):
      real time           0.18 seconds
      cpu time            0.18 seconds


314   proc sort data=perm.temp; by VarName; run;

NOTE: There were 188100 observations read from the data set PERM.TEMP.
NOTE: The data set PERM.TEMP has 188100 observations and 101 variables.
NOTE: PROCEDURE SORT used (Total process time):
      real time           0.34 seconds
      cpu time            0.50 seconds



315  proc glimmix data=perm.temp method=laplace order=internal;
316  by VarName;
317   class  record_id_final  npredictors_ categorical_;
318   model outcome = npredictors_ categorical_ /link=cumlogit dist=multinomial solution;
319    random visit /subject=record_id_final;
320    run;



NOTE: Some observations are not used in the analysis because of: missing response values (n=16038),
      missing fixed effects (n=9), missing subject effects (n=6534).
NOTE: The GLIMMIX procedure is modeling the probabilities of levels of Outcome having lower Ordered
      Values in the Response Profile table.
NOTE: Convergence criterion (FCONV=2.220446E-16) satisfied.
NOTE: At least one element of the (projected) gradient is greater than 1e-3.
NOTE: The above message was for the following BY group:
      VarName=trouble_sleeping
NOTE: PROCEDURE GLIMMIX used (Total process time):
      real time           2:55.20
      cpu time            2:54.98





&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schatr2_0-1635190237910.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65013iFD81BC3F5D58E804/image-size/medium?v=v2&amp;amp;px=400" role="button" title="schatr2_0-1635190237910.png" alt="schatr2_0-1635190237910.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schatr2_1-1635190270931.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/65014iAF4961FA80096EFF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="schatr2_1-1635190270931.png" alt="schatr2_1-1635190270931.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 19:32:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776279#M246841</guid>
      <dc:creator>393310</dc:creator>
      <dc:date>2021-10-25T19:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop for multiple dependent variables in proc glimmix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776289#M246850</link>
      <description>&lt;P&gt;If you look at dataset PERM.TEMP (great name, by the way) you would see you only have one response variable in there, indicating it wasn't created properly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't have two do loops nested inside one another each with the index variable &lt;FONT face="courier new,courier"&gt;I&lt;/FONT&gt;. The third do loop should have index variable &lt;FONT face="courier new,courier"&gt;K&lt;/FONT&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 20:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776289#M246850</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-25T20:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop for multiple dependent variables in proc glimmix</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776299#M246857</link>
      <description>Thanks so much Paige! That fixed the issue perfectly. I really appreciate your help.</description>
      <pubDate>Mon, 25 Oct 2021 21:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-for-multiple-dependent-variables-in-proc-glimmix/m-p/776299#M246857</guid>
      <dc:creator>393310</dc:creator>
      <dc:date>2021-10-25T21:16:40Z</dc:date>
    </item>
  </channel>
</rss>

