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
mbuchecker
Quartz | Level 8

Hi Chirumalla,

PROC DATASETS is part of run group processing, which means that the step doesn't actually finish until it encounters a QUIT statement or the start of a new step. A plain old run statement just executes your COPY statement but does not terminate PROC DATASETS and SYSERR only gets updated correctly when the step has terminated. Simply add a quit statement before checking the value of SYSERR. 

 

/*1-WORKING*/
data NULL;
set doesnotexist;
run;
%put error is &syserr;
/*2-ALSO WORKING*/
PROC DATASETS;
COPY IN=Source OUT=Target MOVE MEMTYPE=DATA;
RUN;
quit;
%put error is &syserr;

Michelle
ChoudharyM
Fluorite | Level 6

Hello Michel,

 

Thanks... It worked for me by doing suggested changes.

 

 

 

Manoj

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 992 views
  • 1 like
  • 3 in conversation