BookmarkSubscribeRSS Feed
SASACC
Calcite | Level 5
Hi,

Please help me with this:

FILENAME prep FTP LIST CD="/env/prod"

HOST = "xxx.xx.xx"

USER = "abcdef" PASS="{sas001}234567ljX3J1bg==";

DATA in_list_file;

INFILE prep MISSOVER;

FORMAT permission $10.;

FORMAT code 3.;

FORMAT owner $10.;

FORMAT group $10.;

FORMAT size 15.;

FORMAT month $3.;

FORMAT day 2.;

FORMAT hour_year $5.;

FORMAT file $60.;

INFORMAT permission $10.;

INFORMAT code 3.;

INFORMAT owner $10.;

INFORMAT group $10.;

INFORMAT size 15.;

INFORMAT month $3.;

INFORMAT day 2.;

INFORMAT hour_year $5.;

INFORMAT file $60.;

INPUT permission $

code

owner $

group $

size

month $

day

hour_year $

file $

;

RUN;


But now we want to remove the ftp path and make to run with out FTP

so I changed as FILENAME prep LIST "/env/prod" ;

But I got message as ERROR: Invalid file, "/env/prod".

I have 3 .txt files (ABC, ABD, ABF) which has to taken into account.

Please let me know how can I get list of all files in the location(/env/prod) so that I can use the below
macro later to find out if input files are empty or not.

%MACRO CheckEmptyFile;

PROC SQL NOPRINT;

SELECT count(*) INTO :nn_obs FROM in_list_file WHERE file LIKE '%AB%' AND size = 0;

QUIT;



%PUT *** &nn_obs ***;



%IF &nn_obs > 0 %THEN %MailScript(Some SO input files are empty !!!);

%MEND CheckEmptyFile;

Please let me know how can I get list of all files in filename so that I can use the above
macro .

Thanks for the help.
1 REPLY 1
CurtisMack
Fluorite | Level 6
I use this little macro to determine the last modified date of the files in a path. It may help.

%macro LastFileModifiedDate(filename);
%global mod_date mod_time;
filename foo pipe "dir &filename /t:w /a:-d";

data _null_;

infile foo firstobs=6;

input mod_date ?? : mmddyy8. mod_time ?? & time8.;

if mod_date eq . then stop;

put mod_date= worddate. / mod_time= timeampm.;
call symput("mod_date",mod_date);
call symput("mod_time",mod_time);
run;
%put %sysfunc(putn(&mod_date,date7.));
%put %sysfunc(putn(&mod_time,time8.));

%mend;
%LastFileModifiedDate(c:\temp\License.txt);

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1086 views
  • 0 likes
  • 2 in conversation