DATA Step, Macro, Functions and more

SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper order.

Reply
New Contributor
Posts: 4

SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper order.

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!!!!!!

 

Super User
Posts: 17,868

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

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. 

http://support.sas.com/documentation/cdl/en/grstatproc/69716/HTML/default/viewer.htm#n19gxtzyuf79t3n...

 

PS SAS UE doesn't suppport SAS/Graph procedures such as GPLOT. 

 

New Contributor
Posts: 4

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

Thank you reeza for your reply.
Can you please add as to how can I get a plot of cd*r vs r*p. Coz as per your edit in scatter, I am getting an error. Please help
Super User
Posts: 17,868

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

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. 

http://support.sas.com/documentation/cdl/en/grstatproc/69716/HTML/default/viewer.htm#n1vkttjoy99wkwn...

New Contributor
Posts: 4

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

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

Super User
Posts: 17,868

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

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. 

 

New Contributor
Posts: 4

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

Thank you for all your help reeza. I created two columns in the existing data with cd*r and r*p and then created the scatter plot. Thanks again
SAS Super FREQ
Posts: 3,482

Re: SAS Univ edition issue : ERROR 180-322: Statement is not valid or it is used out of proper orde

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;
Ask a Question
Discussion stats
  • 7 replies
  • 252 views
  • 0 likes
  • 3 in conversation