2

I am able to resolve the macro variable to the name I was expecting. But delete statement in the proc datasets is not getting recognized. How to make it work?

PROC DATASETS LIB=WORK NODETAILS NOLIST;
    DELETE  &INPUT._mi  &INPUT._lc ;
RUN;

MPRINT(GET_true_value):   PROC DATASETS LIB=WORK NODETAILS NOLIST;
NOTE: Line generated by the macro variable "INPUT".
108          work.true_value_mi
             __________________
             22
             201
MPRINT(GET_true_value):   DELETE work.true_value_mi work.true_value_lc ;
NOTE: Enter RUN; to continue or QUIT; to end the procedure.
MPRINT(GET_true_value):   RUN;

ERROR 22-322: Expecting a name.  

ERROR 201-322: The option is not recognized and will be ignored.

NOTE: Statements not processed because of errors noted above.
109   
3
  • Proc datasets requires a quit in addition to Run so you also need to end the proc. If you've run it a couple of times SAS may be confused. Can also try dropping the library portion of the dataset name. Commented Oct 21, 2015 at 16:42
  • @Reeza The next PROC DATASETS would be define a step boundary so that shouldn't be the issue. Jim's answer is correct here (ie, the second sentence in your comment). Commented Oct 21, 2015 at 18:23
  • Thank you Joe and Reeza. I missed the point. Yeah, after removing the LIB portion, the issue is resolved. My bad, missed the silly thing. Unfortunately have one more issue to resolve. Will post in a separate question :) Commented Oct 21, 2015 at 22:13

1 Answer 1

3

It looks like the problem is that the delete statement as written is including the library name. This is not required (and throws an error) because the library is specified on the PROC DATASETS statement.

You want your macro variables to resolve to this:

PROC DATASETS LIB=WORK NODETAILS NOLIST;
    DELETE true_value_mi ;
RUN;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks alot JimL .. this helped resolving the issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.