BookmarkSubscribeRSS Feed
MG18
Lapis Lazuli | Level 10

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.

4 REPLIES 4
error_prone
Barite | Level 11

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.

MG18
Lapis Lazuli | Level 10

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.

LittlesasMaster
Obsidian | Level 7

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 

MG18
Lapis Lazuli | Level 10

Can we use same method to pass the file name for sas macro ? I have mentioned whole running SAS macro code .

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

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
  • 4 replies
  • 1481 views
  • 0 likes
  • 3 in conversation