03-01-2017 11:35 AM
I trying to automate a process to read an external file.
I recieve a file on a monthly basis, 4-7 days before the start of the New month.
for E.g : the Sales file for the month for April 2017 will be recieved anywhere between 25-31 march.
currently we are reading the file by manualy changing the filenames, and not running this piece of code if we dont have any updates or untill we recieve the New sales file for the next month.
I am listing all the files from the directory and creating a temp datasets which stores all teh files details and from these files i amextracting the date (the filename looks like this : Mnthly_Sales_201702.csv) and sorting the dataset and creating a macro for the recent Sales files.
Now the problem is this file has to be loaded once every month if there are no updates.
Please help me on this.
03-01-2017 12:05 PM
I am listing all the files from the directory and creating a temp datasets which stores all teh files details and from these files i
If you can list all the files, you can use that to dynamically determine which dataset you need to process.
The steps appear correct, what exactly do you need help with, your question is unclear.
03-01-2017 01:47 PM
Apologies for being unclear.
The Job runs daily, if thereare updates or if we have new file the external file needs to read into SAS and other reports need to be generated.
if there are no updates or do not have a new file then the process should exit and continue the other process.
%let dir1 = "/d:/sales/";
x "find -maxdepth 1 -type f -mtime -7 -print > \D:\Santosh\Cmp.txt";
Set filelist; *is the dataset consists the list of files ;
Call Symput('Lst_Rn_Dte', fl_dte);
%put "today ====>&today.";
/*I need help on this i would like to execute this only if we have a new file or an update on the file else exit this process and continue with processing for other files we need to read the external file in advance.*/
%if %sysevalf (&Lst_Rn_Dte.) LE %SYSEVALF(&today.) %then
%put Note:"No File Avaialble.";