11-28-2016 12:13 AM
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
11-28-2016 12:41 AM
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;
See the documentation for detailed code examples.
PS SAS UE doesn't suppport SAS/Graph procedures such as GPLOT.
11-28-2016 12:52 AM
11-28-2016 12:58 AM
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.
11-28-2016 01:06 AM
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
11-28-2016 01:11 AM
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.
11-28-2016 01:30 AM
11-28-2016 10:03 AM
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;