Hi!
Please advise!
I am unable to use PROC SGPLOT in SAS Studio. I am trying to produce a survival curve. The code seems to work for others using the GPLOT on the non-web based version, however for SAS Studio I get an error message:
Proc Sgplot data=temp1;
Plot survival*NMSB=MMSE/vaxis=axis1 haxis=axis2 legend=legend1;
axis1 order=(0 to 1 by .1)
label=(f=swiss h=2 a=90 "Estimated Survival")
value=(f=swiss h=2);
axis2 order=(0 to 80 by 10)
label=(f=swiss h=2 "Months")
value=(f=swiss h=2);
legend1 label=(h=2 "MMSE")
value=(f=swiss h=2);
run;
Hi Reeza,
Thank you for replying so quickly! Can I use PROC GPLOT in the online version of SAS? I read several post that said to substitute SGPLOT instead. Is this correct?
Also, I didn't see the document syntax that you were referring to. Can you please direct me?
Thank you!
Nefertiti
@ojinjide0 wrote:
Hi!
Please advise!
I am unable to use PROC SGPLOT in SAS Studio. I am trying to produce a survival curve. The code seems to work for others using the GPLOT on the non-web based version, however for SAS Studio I get an error message:
180ERROR 180-322: Statement is not valid or it is used out of proper order.Here is the code I am using:Proc Sgplot data=temp1;
Plot survival*NMSB=MMSE/vaxis=axis1 haxis=axis2 legend=legend1;
axis1 order=(0 to 1 by .1)
label=(f=swiss h=2 a=90 "Estimated Survival")
value=(f=swiss h=2);
axis2 order=(0 to 80 by 10)
label=(f=swiss h=2 "Months")
value=(f=swiss h=2);
legend1 label=(h=2 "MMSE")
value=(f=swiss h=2);
run;
Copy the code with the error message from the log. Paste the whole thing into the code box. An Error 180-322 usually has an underscore character under the location of the problem. The code with error and the code box will maintain the formatting to show where the error was found (not always the cause as missing semicolons or mismatched quotes or parentheses prior may be the actual cause).
In your case you have apparently just changed the name of existing Proc GPLOT code to SGPLOT. The plot statements are different and AXIS, SYMBOL, PATTERN and LEGEND statements are not used by SGPLOT.
See https://communities.sas.com/t5/SAS-Studio/Switching-from-GPLOT-to-SGPLOT/m-p/516057#M6641 for a related question.
SGPLOT uses specific types of plots (many more than GPLOT) with different options. I suspect that instead of
Plot survival*NMSB=MMSE/vaxis=axis1 haxis=axis2 legend=legend1;
you want
SCATTER x=nmsb y=survival / group=mmse;
Hi!
That was helpful, thank you! Is there a way to replicate this GPLOT code: symbol l=1 i=step v=dot; for the SGPLOT?
Thank you
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.