BookmarkSubscribeRSS Feed
chirumalla
Calcite | Level 5

Hi I'm using Proc datasets moving option to moving data from one library to another if datasets not available I need to capture Warning/error from code. Same &syserr macro working in data step but not working in proc datasets. pls advise me how to capture error.

/*1-WORKING*/

data NULL;

set doesnotexist;

run; 

%put &syserr;

/*2-NOT WORKING*/

PROC DATASETS;

COPY IN=Source OUT=Target MOVE MEMTYPE=DATA;

RUN;

%put &syserr;

2 REPLIES 2
Reeza
Super User

SYSERR is reset at step boundaries.

Proc Datasets is an interactive procedure and needs a quit statement.

PROC DATASETS;

COPY IN=Source OUT=Target MOVE MEMTYPE=DATA;

RUN;quit;

%put &syserr;

13   PROC DATASETS;

                               Member   File

                      #  Name  Type     Size  Last Modified

                      1  NULL  DATA     5120  13-Apr-14 09:30:41 PM

14   COPY IN=Source OUT=Target MOVE MEMTYPE=DATA;

15   RUN;

ERROR: Libname SOURCE is not assigned.

NOTE: Statements not processed because of errors noted above.

15 !     quit;

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE DATASETS used (Total process time):

      real time           0.73 seconds

      cpu time            0.01 seconds

16   %put &syserr;

1008

chirumalla
Calcite | Level 5

Thanks Reeza...it's working...:)

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1415 views
  • 1 like
  • 2 in conversation