BookmarkSubscribeRSS Feed
lacrefa
Calcite | Level 5

Dear

You can have a look on this type of code, include it inside a macro program :

It test if the file exist and backup it .

 

%let file_src=&original_path./my_file.txt;
%let flag_csc_exist=NO;
data _null_;
fname="tempfile";
rc=filename(fname,"&file_src");
if rc = 0 and fexist(fname) then call symput ('flag_csc_exist','YES');
rc=filename(fname);
run;


%if &flag_csc_exist eq YES %then %do;
%put I must move the file ;
%let file_src_ar=&original_path./archive/my_file.txt_%TRIM(%QSYSFUNC(DATE(), YYMMDDN8.));
filename src_file "&file_src";
filename tgt_file "&file_src_ar";
data _null_;
  infile src_file;
  file tgt_file;
  input;
  put _infile_;
run;
filename src_file clear;
filename tgt_file clear;
%end;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 15 replies
  • 1970 views
  • 5 likes
  • 9 in conversation