BookmarkSubscribeRSS Feed
ankitk321
Fluorite | Level 6

Hi All,

 

I want some alternative for _Error_ in proc copy. I want to copy all dataset from one library to another library and while doing so,if any error occurred I want to use the do and if condition to control the code.

 

For example-:

 

Proc copy in=libname1 out=libname2;

if_error_=1 then do;

%message(call a macro);

%put(" THere is a error while copying");

end;

run;

 

I know _error_ will work with dataset. But not sure either it will work with procedure or not.If anyone can suggest me the alternative for the same it will be a great help.

 

Thanks

Ankit

1 REPLY 1
Kurt_Bremser
Super User

Lots of errors and misunderstandings here:

First, the macro PREprocessor is exactly that: the macro is resolved while the code is being read for execution, not when the procdure runs.

Second, data step code won't work in procedures. Only some statements (eg "by") are quasi-global.

 

Check the automatic macro variable &syscc before and after the proc copy step. Make sure that your code before that step is clean and leaves syscc at its initial value 0.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1 reply
  • 622 views
  • 0 likes
  • 2 in conversation