Data visualization with SAS programming

Help Using GPlot to graph LS Means from Proc Mixed

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Help Using GPlot to graph LS Means from Proc Mixed

[ Edited ]

Hi SAS Community,

 

I am attempting to graph the LS Means from my mixed model in SAS 9.4. But for some reason the line doubles over back to the middle of the graph and I can't figure out why. I have attached my code for the model and graph as well as the means data that is being graphed and a photo of the problem graph. Thanks in advance for your advice!

 

Cara

 

SAS Output

 

 Effect           txgroup   visit      Estimate   StdErr    DF         tValue     Probt    Alpha     Lower     Upper 
txgroupHIV+_76.12600.7518399101.25<.00010.0574.648077.6041
txgroupHIV-_83.48530.7648399109.16<.00010.0581.981884.9887
visit_B1280.23430.7199354111.45<.00010.0578.818581.6502
visit_B2483.88520.7280354115.22<.00010.0582.453485.3169
visit_B075.29740.6983354107.82<.00010.0573.924076.6709
txgroup*visitHIV+B1276.13351.022635474.45<.00010.0574.122478.1447
txgroup*visitHIV+B2480.01971.032735477.49<.00010.0577.988682.0507
txgroup*visitHIV+B072.22491.032935469.92<.00010.0570.193474.2564
txgroup*visitHIV-B1284.33521.013635483.20<.00010.0582.341786.3287
txgroup*visitHIV-B2487.75071.026435485.49<.00010.0585.732089.7693
txgroup*visitHIV-B078.37000.940135483.37<.00010.0576.521280.2188

 

gplot6.png

 

 

ods output lsmeans=means1;
proc mixed data=ultrasound3 method=ml;
   class studyid;
   class txgroup (ref="HIV-");
   class visit (ref="B0");
   model insightstiff = txgroup visit visit*txgroup / s;
   repeated / type=cs subject=studyid group=txgroup;
   lsmeans txgroup visit visit*txgroup / cl adjust=tukey;
   format txgroup txgroupf. visit visitf.;
run;

proc print data=means1; run;

goptions reset=all;
symbol1 c=blue v=star h=.8 i=j;
symbol2 c=red v=dot h=.8 i=j;
symbol3 c=green v=square h=.8 i=j;
axis1 order=(60 to 100 by 5) label=(a=90 'Means');
Title1 'Achilles Insight SI';
Title2 'LS Means by HIV Status Across Study Period';
proc gplot data=means1;
  format estimate 8. visit visitf. txgroup txgroupf.;
  plot estimate*visit=txgroup / vaxis=axis1;
run; 
quit;

 


Accepted Solutions
Solution
a month ago
Super User
Posts: 19,080

Re: Help Using SGPlot to graph LS Means from Proc Mixed

[ Edited ]

You should use SGPLOT, not GPLOT.

 

It's much better quality graphics and easier to use.

 

It's graphing the data in the order it appears - try re-ordering your data or see the ORDER options on SGPLOT.

View solution in original post


All Replies
Solution
a month ago
Super User
Posts: 19,080

Re: Help Using SGPlot to graph LS Means from Proc Mixed

[ Edited ]

You should use SGPLOT, not GPLOT.

 

It's much better quality graphics and easier to use.

 

It's graphing the data in the order it appears - try re-ordering your data or see the ORDER options on SGPLOT.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 112 views
  • 0 likes
  • 2 in conversation