Hello All,
Following is my SAS code:
proc sgplot data=d;
plot cd*r r*p;
run;
I am not sure why am I getting this error:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 55 56 proc sgplot data=d; 57 plot cd*r r*p; ____ 180 ERROR 180-322: Statement is not valid or it is used out of proper order. 58 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SGPLOT used (Total process time): real time 0.01 seconds cpu time 0.01 seconds 59 60 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72
Kindly Help!!!!!!
Plot isn't a valid statement.
PLOT is for GPLOT procedures not SGPLOT.
You can probably use scatter to get what you want.
Proc SGPLOT data=SASHELP.class;
scatter x=height y=weight;
Run:
See the documentation for detailed code examples.
PS SAS UE doesn't suppport SAS/Graph procedures such as GPLOT.
Post your code and log with errors.
To have two series add a SCATTER statement for each x/y combination, they'll be automatically overlayed.
This is an example with SERIES but the idea is the same. Note that your common variable should be on the same axis.
Hello Reeza,
Here's what I tried:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 55 56 proc sgplot data=d; 57 scatter x=cd*r y=r*p; _ _ 79 22 200 200 ERROR 79-322: Expecting a Y. ERROR 22-322: Syntax error, expecting one of the following: ;, /. ERROR 200-322: The symbol is not recognized and will be ignored. 58 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE SGPLOT used (Total process time): real time 0.02 seconds cpu time 0.01 seconds 59 60 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 72
Also I am trying to build a line plot. Will series be the same thing that will help me here. I am new to SAS coding hence, such questions. Apologies
You should read the documentation if your unfamiliar with what goes where.
If you look and run my code you'll notice that x is the variable for the x axis and y is the variable for the y axis.
If you want line plots the example I pointed you to is exactly what you want to try and replicate.
Note which variables go where in the example to modify your code accordingly. Give it another shot and if you have more issue s please post back.
Because the PLOT statement is not a valid staetment in PROC SGPLOT. Here is a link to the PROC SGPLOT documentation.
If you are trying to create two scatter plots, you can use the following statements:
proc sgplot data=d;
scatter y=cd x=r;
run;
proc sgplot data=d;
scatter y=r x=p;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.