Hi All,
I need help on below code and below code is working fine but now we are having 500 monthly files in the watch-list folder.
(/saswas/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/) and i want to load the all file using the below code.
What is the solution for this issue ?
how can i loop these files and pass it to the %wl_dwjn_process macro ?
how to create array with file name and store it ?
%macro aml_dwjn_monthly;
%local dwjn_file_monthly;
%let dwjn_file_monthly=/saswas/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/monthly.csv;
%put &dwjn_file_monthly;
/* Get the current runasofdate */
%aml_getrundate;
%put NOTE: AML: RUNASOFDATE: &runasofdate;
/* USER SETTINGS */
%wl_dwjn_process
(
dwjn_file=&dwjn_file_monthly,
load_type=N,
allow_invalid=FULL,
bulkload=%str(bulkload=yes)
);
%mend aml_dwjn_monthly;
many thanks in advance.
You didn't post any data, the source code of the macros used or rhw log generated, making it really difficult to help you.
If all files have the same structure, you don't nee macro code, you can import all with a single data-step using wildcards in the infile-statement you will find many posts explaining the this further.
Hi @error_prone,
I have added the piece of code which is running successfully with single file (i.e. monthly.csv ) but now we are having 500 file with same format as old file.
%let dwjn_file_monthly=/saswas/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/monthly.csv;
Can you please provide the link for the single data-step using wildcards ? This will be a great help.
Hi,
If you want to read multiple files into one single step, you can simply use wildcards in infile statement
Lets your file names are
monthly1
monthly2
monthly3
....
......
monthly500
THen you can simple write a code -
Data mydateste;
infile "/saswas/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/monthly*.csv" DSD;
run;
Limitation-
All files should have same structure
Can we use same method to pass the file name for sas macro ? I have mentioned whole running SAS macro code .
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.