I have several datasets that I would like to delete after my SAS procedure has finished. I am using this statement:
proc datasets lib=temp;
delete xtemp2&sysparm trades&sysparm tickers&sysparm;
quit;
run;
where
&sysparm evaluates to a number and temp to a libname. However, I receive the following errors in the log file:
142 delete xtemp2&sysparm trades&sysparm tickers&sysparm;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
Anyone know the issue?
EDIT:
Here is some more of the log file to address the answer:
NOTE: "OUT_CSV" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
real time 0.27 seconds
cpu time 0.12 seconds
142 delete xtemp2&sysparm trades&sysparm tickers&sysparm;
______
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
Here is the code immediately prior to the proc:
proc export data=temp.xtemp2&sysparm outfile=out_csv dbms=csv replace;
run;
proc datasets lib=temp;
delete xtemp2&sysparm trades&sysparm tickers&sysparm;
quit;
run;
There's nothing explicitly wrong with your code, except that last RUN is not needed (QUIT is sufficient for PROC DATASETS). I created datasets with those parameters and the code as provided worked fine. Often that error comes when you have something just before the proc statement that causes the proc statement not to compile. For example:
*
proc datasets lib=temp;
delete xtemp2&sysparm trades&sysparm tickers&sysparm;
quit;
would cause the error message you provided, along with almost anything else that was not properly ended (although most other errors of that nature would cause a second error message with the preceding statement).
Looking at your log, it seems that you are not executing your PROC DATASETS statement, such that the `delete' statement is showing up in open code. As Joe said, you probably have a stray character in your code. If not, please repost with more infor from your SAS log. Include everything from the previous step boundary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With