Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete SAS dataset

Tags:

dataset

sas

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;
like image 568
Alex Avatar asked Dec 05 '25 08:12

Alex


2 Answers

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).

like image 77
Joe Avatar answered Dec 10 '25 00:12

Joe


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.

like image 33
BellevueBob Avatar answered Dec 10 '25 00:12

BellevueBob