Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coniditional Execution of data step 1

Status
Not open for further replies.

bkclaw113

IS-IT--Management
Jun 10, 2002
71
US
Is there a way to check for the existance of a required dataset and have two branches of code to handle:
a: Input Dataset exist
b: Input Dataset does not exist

A general outline of what I am trying to do is this:
Code:
%let fileIn = "c:\temp\filename.txt";

%if FILEEXISTS(fileIN) %then %do;
[COLOR=green]	/* Code segment 1	*/
	/* DATA STEP 1a		*/
	/* Data STEP 2a		*/ [/color]
%else %do;
[COLOR=green]	/* Code segment 2	*/
	/* DATA STEP 1b		*/
	/* DATA STEP 2b		*/ [/color]
%end;
 
I guess that my instincts were closer than I thought. the only thing that I was missing was %sysfunc.

Code:
 %if %sysfunc(fileexist(&fileref)) %then %do;
 
Nice one! Thanks for posting the answer! Here, have a purple star. That looks like a very useful setup, I'll have to make a note of it. Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top