BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
StatDave
SAS Super FREQ
Actually, it is more likely that would result from the data not being in proper sorted order. Be sure that the values in the DATA= data set are sorted in increasing order of the X axis variable (cPAreactpost).
Heejeong
Obsidian | Level 7

Thank you so much!

So I tried the code below to proc sort the data by the predictor but got the following error message:

Heejeong_0-1652050408986.png

I also tried deleting the values statement but it didn't change the figure shape. Thank you so much for troubleshooting this with me!

 

 proc means data=JH.Final3;
      var cPAreactpost; 
      output out=out mean=mean std=sd;
      run;
    data mdat;
      set out;
      keep cPAreactpost;
      do cPAreactpost = mean-sd, mean, mean+sd;
        output;
      end;
      run;
    %Margins(data=JH.Final3, response=B4BNOCRE, model=cage ClinicSex marriedmidus work race_orig  cedu cHHtotalIncome EverSmokeReg Exercise20mins CNSmeds cBMI cCESD cNeuroticism  cChronCondNumb  cAnyStressWide_sum cpa_mlm2 cPAreactpost,
             margins=cPAreactpost, margindata=mdat,
             options=diff reverse cl)
proc sort data=_margins; by cPAreactpost; run;
proc sgplot data=_margins noautolegend; band upper=UPPER lower=LOWER x=cPAreactpost ;*/ transparency=.3; series y=ESTIMATE x=cPAreactpost; xaxis values=(-0.0627 0 0.0627) grid offsetmin=.05 offsetmax=.05 label="Positive Affective Responsivity"; yaxis values=(10 to 40 by 5) grid offsetmin=.05 offsetmax=.05 label="Norepinephrine"; title "Effects of Positive Affective Responsivity on Norepinephrine"; run;

 

 

 

StatDave
SAS Super FREQ
Perhaps you have the _MARGINS data set open in a ViewTable window. If not, try adding an OUT= option in your PROC SORT step (proc sort data=_margins out=mymargins; ...) and then using the MYMARGINS data in PROC SGPLOT. If none of that works, close and restart SAS and rerun all of it (with the OUT= in PROC SORT).
Heejeong
Obsidian | Level 7

I closed everything and reran the syntax with the "with the OUT= in PROC SORT" and it worked! I can't be more thankful for all your help today! I learned so much and feel so much more confident with my analyses. Thank you so much, @StatDave , for your helpful and fast responses even at night time! I really appreciate it. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 18 replies
  • 1659 views
  • 6 likes
  • 4 in conversation