07-01-2021
cjacks21
Calcite | Level 5
Member since
06-09-2020
- 22 Posts
- 1 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by cjacks21
Subject Views Posted 1217 06-24-2021 12:20 PM 1217 06-24-2021 12:16 PM 1225 06-24-2021 11:44 AM 3176 06-23-2021 11:58 AM 1353 06-10-2021 05:33 PM 1406 05-21-2021 12:22 PM 1413 05-21-2021 11:08 AM 3247 05-18-2021 03:29 PM 3260 05-18-2021 11:03 AM 3285 05-17-2021 11:16 AM -
Activity Feed for cjacks21
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 06-24-2021 12:20 PM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 06-24-2021 12:16 PM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 06-24-2021 11:44 AM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 06-23-2021 11:58 AM
- Posted Re: Proc Mixed Fixed Effects Class Variable with more than two levels and values. on Statistical Procedures. 06-10-2021 05:33 PM
- Posted Re: Proc Mixed Fixed Effects Class Variable with more than two levels and values. on Statistical Procedures. 05-21-2021 12:22 PM
- Posted Re: Proc Mixed Fixed Effects Class Variable with more than two levels and values. on Statistical Procedures. 05-21-2021 11:08 AM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-18-2021 03:29 PM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-18-2021 11:03 AM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-17-2021 11:16 AM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-17-2021 11:04 AM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-13-2021 08:28 PM
- Posted Re: Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-13-2021 02:29 PM
- Posted Proc MIXED MODEL Warning: For covariance type Unstructured on Statistical Procedures. 05-12-2021 03:46 PM
- Posted Proc Mixed Fixed Effects Class Variable with more than two levels and values. on Statistical Procedures. 05-11-2021 02:39 PM
- Posted Output New SAS Data Set on New SAS User. 10-15-2020 11:49 AM
- Posted Re: How to compare class variables with more than two levels in proc mixed? on New SAS User. 09-17-2020 12:54 PM
- Posted Re: How to compare class variables with more than two levels in proc mixed? on New SAS User. 09-17-2020 12:30 PM
- Posted Re: How to compare class variables with more than two levels in proc mixed? on New SAS User. 09-17-2020 12:15 PM
- Posted Re: How to compare class variables with more than two levels in proc mixed? on New SAS User. 09-17-2020 12:01 PM
-
Posts I Liked
Subject Likes Author Latest Post 1
06-24-2021
12:16 PM
Yes. I also noticed I rename group to yr and in the model and random statement I had year instead of yr. It works now.
... View more
06-24-2021
11:44 AM
@jiltao Your request is below. I also attempted some of the options on the document I found online. When I changed the method for estimating the covariance parameters from REML to MIVQUE0 the data set converged. I attached the sheet of tips to help. Also, do you think it may be because I am missing data for viral load? It reads in the files as "." The dataset is unbalanced and contains missing data. I do not know if that would cause the proc mixed model to not converge. SAS code proc sort data = Firstvisit;
by rfa_id testdate year;
RUN;
data avegvl_youth;
set Firstvisit;
keep rfa_id test_year testdate year sex_hars res_at_hiv_dx race_combined hiv_risk agegroup ccd4c ctimeyr days year mn quarter time first_cd4cgp result_vl_log10;
by rfa_id testdate year;
run;
data youth_year;
set avegvl_youth;
if year=1999 then group = "1" ;
else if year = 2000 then group = "2";
else if year = 2001 then group = "3";
else if year = 2002 then group = "4";
else if year = 2003 then group = "5";
else if year = 2004 then group = "6";
else if year = 2005 then group = "7";
else if year = 2006 then group = "8";
else if year = 2007 then group = "9";
else if year = 2008 then group = "10";
else if year = 2009 then group = "11";
else if year = 2010 then group = "12";
else if year = 2011 then group = "13";
else if year = 2012 then group = "14";
else if year = 2013 then group = "15";
else if year = 2014 then group = "16";
else if year = 2015 then group = "17";
else if year = 2016 then group = "18";
else if year = 2017 then group = "19";
else if year = 2018 then group = "20";
else if year = 2019 then group = "21";
else if year = 2020 then group = "22";
rename group = yr;
run;
************************************* 1st Proc Mixed Code *****************************************************;
************************************* Unstructured *****************************************************;
proc sort data = youth_year out = avegvl_youth_sort nodupkey;
by rfa_id testdate year result_vl_log10;
RUN;
PROC MIXED data= avegvl_youth_sort covtest method=reml PLOTS(MAXPOINTS=NONE)noitprint;
class rfa_id sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black")
hiv_risk (ref="MSM") first_cd4cgp (ref="> 500") agegroup(ref="20-24");
model result_vl_log10= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk first_cd4cgp
agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk ccd4c*first_cd4cgp
ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk
ctimeyr*first_cd4cgp ctimeyr*agegroup/ solution cl outp = pred_un ;
random intercept year / type= un subject=rfa_id;
lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk first_cd4cgp agegroup /diff adjust= tukey;
title 'Mixed Model Results For Viral Load';
RUN; The output starts here: 581 proc sort data = Firstvisit;
582 by rfa_id testdate year;
583 RUN;
NOTE: There were 57534 observations read from the data set WORK.FIRSTVISIT.
NOTE: The data set WORK.FIRSTVISIT has 57534 observations and 36 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.07 seconds
cpu time 0.07 seconds
584
585 data avegvl_youth;
586 set Firstvisit;
587 keep rfa_id test_year testdate year sex_hars res_at_hiv_dx race_combined hiv_risk agegroup
587! ccd4c ctimeyr days year mn quarter time first_cd4cgp result_vl_log10;
588 by rfa_id testdate year;
589 run;
NOTE: There were 57534 observations read from the data set WORK.FIRSTVISIT.
NOTE: The data set WORK.AVEGVL_YOUTH has 57534 observations and 17 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
590
591
592 data youth_year;
593 set avegvl_youth;
594 if year=1999 then group = "1" ;
595 else if year = 2000 then group = "2";
596 else if year = 2001 then group = "3";
597 else if year = 2002 then group = "4";
598 else if year = 2003 then group = "5";
599 else if year = 2004 then group = "6";
600 else if year = 2005 then group = "7";
601 else if year = 2006 then group = "8";
602 else if year = 2007 then group = "9";
603 else if year = 2008 then group = "10";
604 else if year = 2009 then group = "11";
605 else if year = 2010 then group = "12";
606 else if year = 2011 then group = "13";
607 else if year = 2012 then group = "14";
608 else if year = 2013 then group = "15";
609 else if year = 2014 then group = "16";
610 else if year = 2015 then group = "17";
611 else if year = 2016 then group = "18";
612 else if year = 2017 then group = "19";
613 else if year = 2018 then group = "20";
614 else if year = 2019 then group = "21";
615 else if year = 2020 then group = "22";
616 rename group = yr;
617 run;
NOTE: There were 57534 observations read from the data set WORK.AVEGVL_YOUTH.
NOTE: The data set WORK.YOUTH_YEAR has 57534 observations and 18 variables.
NOTE: DATA statement used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
618
619 ************************************* 1st Proc Mixed Code
619! *****************************************************;
620 ************************************* Unstructured
620! *****************************************************;
621
622
623 proc sort data = youth_year out = avegvl_youth_sort nodupkey;
624 by rfa_id testdate year result_vl_log10;
625 RUN;
NOTE: There were 57534 observations read from the data set WORK.YOUTH_YEAR.
NOTE: 207 observations with duplicate key values were deleted.
NOTE: The data set WORK.AVEGVL_YOUTH_SORT has 57327 observations and 18 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
626
627
628 PROC MIXED data= avegvl_youth_sort covtest method=reml PLOTS(MAXPOINTS=NONE)noitprint;
629 class rfa_id sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined
629! (ref="Black")
630 hiv_risk (ref="MSM") first_cd4cgp (ref="> 500") agegroup(ref="20-24");
631 model result_vl_log10= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined
631! hiv_risk first_cd4cgp
632 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk
632! ccd4c*first_cd4cgp
633 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined
633! ctimeyr*hiv_risk
634 ctimeyr*first_cd4cgp ctimeyr*agegroup/ solution cl outp = pred_un ;
635 random intercept year / type= un subject=rfa_id;
636 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk first_cd4cgp agegroup /diff
636! adjust= tukey;
637 title 'Mixed Model Results For Viral Load';
638 RUN;
NOTE: 16629 observations are not included because of missing values.
NOTE: The data set WORK.PRED_UN has 0 observations and 0 variables.
WARNING: Data set WORK.PRED_UN was not replaced because new file is incomplete.
NOTE: PROCEDURE MIXED used (Total process time):
real time 10.39 seconds
cpu time 10.10 seconds
... View more
06-23-2021
11:58 AM
@jiltao Hello, So I am still working on this issue. I round the dependent variables to just one decimal place after the decimal. I also recoded the years for example 1999 and put for example, 1, 2, 3, 4, etc.It still did not work. It also removed the warning but the OUTP=data set is empty. With no columns nor rows. Courtney Jacks
... View more
06-10-2021
05:33 PM
Thank you. This worked.
... View more
05-21-2021
12:22 PM
Yes, the LSMEASN output the result. I am very new to SAS so I hope I am not confusing myself. I can upload my results. My SAS code is below. On the class line I added all my fixed variables and reference one value. For example race = race_combined (ref "Black"). In the result I get Solution for Fixed Effects which compared Black vs White and Black vs Other. The random variable is viral load. How do I get White vs Other? Will the output be within my "Solution for Fixed Effects ". I also use LSMEANS and did it also. Is the Solution for FIXED Effects and Least Squares Means the same thing? ************************************* Proc Mixed Code ***********************************;
**************************************** Mixed Model ************************************;
*********************************Viral Load by Year for Youth********************************;
ods rtf file = "C:\Users\cjacks1\Downloads\Data\Youthprocmixedmodelstest.rtf";
data avegvl_youth;
set Firstvisit;
keep rfa_id test_year testdate year sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup ccd4c ctimeyr days year mn quarter time presentvl result_vl_log10;
by rfa_id test_year testdate year;
if result_vl>=0 then presentvl=1 ;
*else if result_vl="." then delete;
run;
*Code incldues and removes repeated viral load that were averaged by year;
proc sql;
create table youthavgvl_yr as
select *, mean(case when presentvl =1 then result_vl_log10
else .
end) as avgvlyryouth
from avegvl_youth
group by rfa_id, year;
quit;
************************************* 1st Proc Mixed Code *****************************************************;
************************************* Youth Part 1 *****************************************************;
*sort data set with average viral load by rfa_id time and average viral load by year;
*proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
*by rfa_id year time avgvlyryouth;
*run;
*ods rtf;
*Proc mix to look at youth mean viral load by residence, cd4, sex, race, and gender ;
* multilevel (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
*PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml PLOTS(MAXPOINTS=NONE);
*class rfa_id sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
*model avgvlyryouth = year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup/ solution outp = pred;
* random int year / subject=rfa_id Type= un vcorr;
*title 'Mixed Model Results For Viral Load Trend Over Time For Youth Visits (Reference 1)';
*RUN;
*ods rtf close;
*ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk ctimeyr*baseline_cd4 ctimeyr*agegroup
************************************* Youth Proc Mixed Models *****************************************************;
*CJacks notes;
*3 proc mixed models where used to determine which TYPE= was the best for the data analysis of mean vl over time;
*TYPE= UN, CS, and AR(1);
*sort data set with average viral load by rfa_id time and average viral load by year;
proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
by rfa_id year time avgvlyryouth;
run;
*When I ran the procedure without adding intercept or int after random the output showed everything but with it some outputs where
cut out;
PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml PLOTS(MAXPOINTS=NONE);
class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4
agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk
ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp = pred_un ;
*random intercept year/ Type= un subject=rfa_id;
random year / type= un subject= rfa_id;
lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup /diff;
title 'Mixed Model Test for Youth Unstructured';
RUN;
ods rtf close; Output Log: 483 *CJacks notes;
484 *3 proc mixed models where used to determine which TYPE= was the best
484! for the data analysis of mean vl over time;
485 *TYPE= UN, CS, and AR(1);
486 *sort data set with average viral load by rfa_id time and average
486! viral load by year;
487
488 proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey;
488! *remove duplicates;
489 by rfa_id year time avgvlyryouth;
490 run;
NOTE: There were 57534 observations read from the data set
WORK.YOUTHAVGVL_YR.
NOTE: 10467 observations with duplicate key values were deleted.
NOTE: The data set WORK.YOUTHAVGVL_YR_SORTED has 47067 observations and
19 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
491 *When I ran the procedure without adding intercept or int after
491! random the output showed everything but with it some outputs where
492 cut out;
493 PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml
493! PLOTS(MAXPOINTS=NONE);
494 class sex_hars (ref="F") res_at_hiv_dx (ref="Urban")
494! race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref=">
494! 500") agegroup(ref="20-24");
495 model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx
495! race_combined hiv_risk baseline_cd4
496 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx
496! ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
497 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx
497! ctimeyr*race_combined ctimeyr*hiv_risk
498 ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp =
498! pred_un ;
499 *random intercept year/ Type= un subject=rfa_id;
500 random year / type= un subject= rfa_id;
501 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk
501! baseline_cd4 agegroup /diff;
502 title 'Mixed Model Test for Youth Unstructured';
503 RUN;
NOTE: 7898 observations are not included because of missing values.
NOTE: The data set WORK.PRED_UN has 47067 observations and 26 variables.
NOTE: PROCEDURE MIXED used (Total process time):
real time 7.01 seconds
cpu time 6.75 seconds
504 ods rtf close;
... View more
05-21-2021
11:08 AM
Hello, So after speaking with my PI this is not what I am looking for. I need to to estimates for the fixed effects with more than 2 levels in sas. Do you know how I can achieve this? With LSMEANS computes least squares means (LS-means) of fixed effects.
... View more
05-18-2021
03:29 PM
Hello, Okay. I will look into that. The response variable is the viral load which was converted to log_10. I can not send the data set but I will take a look at what you suggested.
... View more
05-18-2021
11:03 AM
Hello, I am so sorry. I missed that part of the reply. My Output window was empty but I did have the Result. I attached it to the reply as a word document. The code log is below again: 346 ************************************* 1st Proc Mixed Code
346! *****************************************************;
347 ************************************* Youth Part 1
347! *****************************************************;
348 *sort data set with average viral load by rfa_id time and average
348! viral load by year;
349 *proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey;
349! *remove duplicates;
350 *by rfa_id year time avgvlyryouth;
351 *run;
352
353 *ods rtf;
354 *Proc mix to look at youth mean viral load by residence, cd4, sex,
354! race, and gender ;
355 * multilevel (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref=">
355! 500") agegroup(ref="20-24");
356 *PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml
356! PLOTS(MAXPOINTS=NONE);
357 *class rfa_id sex_hars (ref="F") res_at_hiv_dx (ref="Urban")
357! race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref=">
357! 500") agegroup(ref="20-24");
358 *model avgvlyryouth = year ccd4c ctimeyr sex_hars res_at_hiv_dx
358! race_combined hiv_risk baseline_cd4 agegroup/ solution outp = pred;
359 * random int year / subject=rfa_id Type= un vcorr;
360 *title 'Mixed Model Results For Viral Load Trend Over Time For
360! Youth Visits (Reference 1)';
361 *RUN;
362 *ods rtf close;
363
364 *ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined
364! ccd4c*hiv_risk ccd4c*baseline_cd4 ccd4c*agegroup ctimeyr*sex_hars
364! ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk
364! ctimeyr*baseline_cd4 ctimeyr*agegroup
365
366
367 ************************************* Youth Proc Mixed Models
367! *****************************************************;
368 *CJacks notes;
369 *3 proc mixed models where used to determine which TYPE= was the best
369! for the data analysis of mean vl over time;
370 *TYPE= UN, CS, and AR(1);
371 *sort data set with average viral load by rfa_id time and average
371! viral load by year;
372
373 proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey;
373! *remove duplicates;
374 by rfa_id year time avgvlyryouth;
375 run;
NOTE: There were 57534 observations read from the data set
WORK.YOUTHAVGVL_YR.
NOTE: 10467 observations with duplicate key values were deleted.
NOTE: The data set WORK.YOUTHAVGVL_YR_SORTED has 47067 observations and
19 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
376 *When I ran the procedure without adding intercept or int after
376! random the output showed everything but with it some outputs where
377 cut out;
378 PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml
378! PLOTS(MAXPOINTS=NONE);
379 class sex_hars (ref="F") res_at_hiv_dx (ref="Urban")
379! race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref=">
379! 500") agegroup(ref="20-24");
380 model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx
380! race_combined hiv_risk baseline_cd4
381 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx
381! ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
382 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx
382! ctimeyr*race_combined ctimeyr*hiv_risk
383 ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp =
383! pred_un ;
384 random intercept year/ Type= un subject=rfa_id;
385 *random year / type= un subject= rfa_id;
386 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk
386! baseline_cd4 agegroup /diff;
387 title 'Mixed Model Test for Youth Unstructured';
388 RUN;
NOTE: 7898 observations are not included because of missing values.
NOTE: The data set WORK.PRED_UN has 0 observations and 0 variables.
WARNING: Data set WORK.PRED_UN was not replaced because new file is
incomplete.
NOTE: PROCEDURE MIXED used (Total process time):
real time 1.21 seconds
cpu time 0.92 seconds
389 ods rtf close;
... View more
05-17-2021
11:16 AM
Hello, I added the year to the class statement in the proc mixed model and for year there are 21 levels. Courtney Jacks
... View more
05-17-2021
11:04 AM
Hello, Yes. The log out put is below for that structure. 268 proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey;
268! *remove duplicates;
269 by rfa_id year time avgvlyryouth;
270 run;
NOTE: There were 57534 observations read from the data set
WORK.YOUTHAVGVL_YR.
NOTE: 10467 observations with duplicate key values were deleted.
NOTE: The data set WORK.YOUTHAVGVL_YR_SORTED has 47067 observations and
19 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
271 *When I ran the procedure without adding intercept or int after
271! random the output showed everything but with it some outputs where
272 cut out;
273 PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml
273! PLOTS(MAXPOINTS=NONE);
274 class sex_hars (ref="F") res_at_hiv_dx (ref="Urban")
274! race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref=">
274! 500") agegroup(ref="20-24");
275 model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx
275! race_combined hiv_risk baseline_cd4
276 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx
276! ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
277 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx
277! ctimeyr*race_combined ctimeyr*hiv_risk
278 ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp =
278! pred_un ;
279 random intercept year/ Type= un subject=rfa_id;
280 *random year / type= un subject= rfa_id;
281 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk
281! baseline_cd4 agegroup /diff;
282 title 'Mixed Model Test for Youth Unstructured';
283 RUN;
NOTE: 7898 observations are not included because of missing values.
NOTE: The data set WORK.PRED_UN has 0 observations and 0 variables.
NOTE: PROCEDURE MIXED used (Total process time):
real time 1.21 seconds
cpu time 0.88 seconds
... View more
05-13-2021
08:28 PM
Hello very close. I am sorry for the confusion. Model 1 is the TYPE= UN and Model 2 = CS. For both models I am trying to use the random intercept and time which equal year on my model. When I use: random intercept year / subject=rfa_id type=un I do not get any outputs. It seems as if the code stops. For the compound symmetry type (model 2) I get a result.
... View more
05-13-2021
02:29 PM
Thank you so much for you help in advance. I have be trouble shooting this for a couple days.
... View more
05-12-2021
03:46 PM
Hello, I am having trouble getting the result I need from my proc mixed models. I am comparing 3 different types but for some reason my Proc Mixed model with the covariance structure Type=un (unstructured) ran and I add the intercept on the random line the result are an warning, the solution LSMEANS is missing, and no out put of my predicted values. For the proc mixed model type= cs everything is fine with the intercept added. I attached the output to this post and the code and code log is below. What do I need to change for me to used intercept and year in my un proc mixed model? NOTE: 7898 observations are not included because of missing values. NOTE: The data set WORK.PRED has 0 observations and 0 variables. ------>WARNING: Data set WORK.PRED was not replaced because new file is incomplete.<----- NOTE: PROCEDURE MIXED used (Total process time): real time 0.88 seconds cpu time 0.68 seconds SAS Code: proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
by rfa_id year time avgvlyryouth;
run;
*When I ran the procedure without adding intercept or int after random the output showed everything but with it some outputs where
cut out;
PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml PLOTS(MAXPOINTS=NONE);
class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4
agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk
ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp = pred;
random intercept / subject=rfa_id Type= un;
lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup /diff;
title 'Mixed Model Test for Youth Unstructured';
RUN;
proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
by rfa_id year time avgvlyryouth;
run;
PROC MIXED data= youthavgvl_yr_sorted order=data PLOTS(MAXPOINTS=NONE);
class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black") hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4
agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk ccd4c*baseline_cd4
ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined ctimeyr*hiv_risk
ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp = pred_cs;
random intercept year / subject=rfa_id Type= cs;
lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup /diff;
title 'Mixed Model Test for Youth Compound Symmetry';
RUN; SAS log: SAS log
458 proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
459 by rfa_id year time avgvlyryouth;
460 run;
NOTE: There were 57534 observations read from the data set WORK.YOUTHAVGVL_YR.
NOTE: 10467 observations with duplicate key values were deleted.
NOTE: The data set WORK.YOUTHAVGVL_YR_SORTED has 47067 observations and 19 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
461 *When I ran the procedure without adding intercept or int after random the output showed
461! everything but with it some outputs where
462 cut out;
463 PROC MIXED data= youthavgvl_yr_sorted covtest noitprint method=reml PLOTS(MAXPOINTS=NONE);
464 class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black")
464! hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
465 model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk
465! baseline_cd4
466 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk
466! ccd4c*baseline_cd4
467 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined
467! ctimeyr*hiv_risk
468 ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp = pred;
469 random intercept / subject=rfa_id Type= un;
470 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup /diff;
471 title 'Mixed Model Test for Youth Unstructured';
472 RUN;
NOTE: 7898 observations are not included because of missing values. NOTE: The data set WORK.PRED has 0 observations and 0 variables. WARNING: Data set WORK.PRED was not replaced because new file is incomplete. NOTE: PROCEDURE MIXED used (Total process time): real time 0.88 seconds cpu time 0.68 seconds NOTE: PROCEDURE MIXED used (Total process time):
real time 0.88 seconds
cpu time 0.68 seconds
473
474 proc sort data = youthavgvl_yr out= youthavgvl_yr_sorted nodupkey; *remove duplicates;
475 by rfa_id year time avgvlyryouth;
476 run;
NOTE: There were 57534 observations read from the data set WORK.YOUTHAVGVL_YR.
NOTE: 10467 observations with duplicate key values were deleted.
NOTE: The data set WORK.YOUTHAVGVL_YR_SORTED has 47067 observations and 19 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.04 seconds
cpu time 0.04 seconds
477
478 PROC MIXED data= youthavgvl_yr_sorted order=data PLOTS(MAXPOINTS=NONE);
479 class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="Black")
479! hiv_risk (ref="MSM") baseline_cd4 (ref="> 500") agegroup(ref="20-24");
480 model avgvlyryouth= year ccd4c ctimeyr sex_hars res_at_hiv_dx race_combined hiv_risk
480! baseline_cd4
481 agegroup ccd4c*sex_hars ccd4c*res_at_hiv_dx ccd4c*race_combined ccd4c*hiv_risk
481! ccd4c*baseline_cd4
482 ccd4c*agegroup ctimeyr*sex_hars ctimeyr*res_at_hiv_dx ctimeyr*race_combined
482! ctimeyr*hiv_risk
483 ctimeyr*baseline_cd4 ctimeyr*agegroup/ solution outp = pred_cs;
484 random intercept year / subject=rfa_id Type= cs;
485 lsmeans sex_hars res_at_hiv_dx race_combined hiv_risk baseline_cd4 agegroup /diff;
486 title 'Mixed Model Test for Youth Compound Symmetry';
487 RUN;
NOTE: 7898 observations are not included because of missing values.
NOTE: Convergence criteria met.
NOTE: Estimated G matrix is not positive definite.
NOTE: The data set WORK.PRED_CS has 47067 observations and 26 variables.
NOTE: PROCEDURE MIXED used (Total process time):
real time 50.90 seconds
cpu time 50.49 seconds
... View more
05-11-2021
02:39 PM
Hello I a new to SAS. I am creating a model that looks at the mean HIV viral load over time by gender, race/ethnicity, age group, residency, HIV risk exposure, and first (baseline) cd4 count. I know how the use the CLASS variable and ( "REF= option") to look at the difference in viral load by variable with only 2 levels. I want to compare results with a variable with more than 2 levels. For example race/ethnicity has 3 levels: Black, White, and Other. So I want to compare Black to White, Black to Other, and White to Other. Because I reference white the proc mixed in SAS will compare White vs Blacks and White vs Other. But I am trying to get Black Vs White without creating an new model. My proc mixed SAS code is below: *sort data set with average viral load; proc sort data = avgvlqrt out= avgvlqrt_sorted nodupkey; by rfa_id time avgvl; run; *Proc mix to look at youth mean viral load by residence, cd4, sex, race, and gender ; PROC MIXED data= avgvlqrt_sorted covtest noclprint noitprint method=reml PLOTS(MAXPOINTS=NONE); class sex_hars (ref="F") res_at_hiv_dx (ref="Urban") race_combined (ref="White") agegroupdx (ref="Adolesce") risk_hars_n (ref="Heterosexual") cd4base_dx (ref="< 200"); model avgvl= time sex_hars res_at_hiv_dx race_combined risk_hars_n agegroupdx cd4base_dx / solution; random time / subject=rfa_id Type= un vcorr; RUN;
... View more