Posts

Showing posts with the label fileexist

How to check if the File is exist or not in SAS

How to check if the File is exist or not in SAS: Guys… Let me try explaining how to check if the file exist in the library or directory using SAS. Here I am writing a macro to check if the file exist in the directory or not. Here is the way to check it… % macro check(dir= ) ; %if %sysfunc ( fileexist (&dir)) %then %do; % put File Exists ; % end ; %else %do ; %put File doesn’t exist.; % end ; % mend ; %check (dir=" C:\Documents and Settings\sannapareddy\Desktop\Holidays 2009.docx" ); %sysfunc option empowers me to use the same Data step functions outside the Data step. Almost all of the Data step functions are available to use outside the data step if we use %sysfunc. fileexist option, verifies the existence of an external file. It can also verifies the SAS library. Here is another simple technique to check..... data _null_ ; x= filexist( 'C:\Documents and Settings\sannapareddy\Desktop\Holidays 2009.docx' ); call...