BookmarkSubscribeRSS Feed
John1231
Fluorite | Level 6

Hi,

 

 

I have a macro which checks if the file exist and if it doesnt i want to append a different data set to another set.

 

So I have an idea to use syserr option

 

%if &syserr > 1 %then %do ;

proc append base=base.data data=test_data  force;

%end;

 

but I want to specify that if concrete error occurs "physical file doesnt exist" then the proc append will work.

 

Is there a such possibility ?

4 REPLIES 4
John1231
Fluorite | Level 6

i had a problem with fexist, but  i fixed it so it's ok.

 

but i'm curious, is there a possibility to determine condtional logic based on a specified error ?

Kurt_Bremser
Super User

If you have a code that identifies a specific error, you can use that. But the documentation for &syserr does not show a particular code for "physical file does not exist". So I recommend to check with fexist, as you otherwise might do something unexpected when another error occurs.

Peter_C
Rhodochrosite | Level 12
and FILEEXIST()

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
  • 4 replies
  • 466 views
  • 2 likes
  • 3 in conversation