Published on :
Macro EXTERNE

AHGrefreshfolder Macro for file processing by extension

This code is also available in: Deutsch Español Français
This macro iterates over a list of folders provided as a parameter. For each folder, it uses a functional loop (`%AHGfuncloop`) to apply a recursive operation (`%AHGrdown`, probably for 'recursive down') on files matching the defined extensions (by default: sas©, sasdrvr, sas©7bdat). It also includes a command save via `%AHGsavecommandline`.
Data Analysis

Type : EXTERNE


The macro operates on directory paths and file types provided as parameters, without loading SAS data tables.

1 Code Block
MACRO
Explanation :
Macro definition with local variable initialization, context saving, and a double loop (over folders via %do and extensions via %AHGfuncloop) to trigger processing via nested calls to other utility macros.
Copied!
1%macro AHGrefreshfolder(folders,exts=sas sasdrvr sas7bdat );
2 %local i macroname;
3 %let macroname=&sysmacroname;
4 %AHGsavecommandline(¯oname);
5
6 %DO i=1 %to %AHGcount(&folders);
7 
8 %AHGfuncloop(%nrbquote( AHGrdown(save=0,rlevel=3,folder=%scan(&folders,&i),filename=*.ahuige ) ),
9 loopvar=ahuige,loops= &exts
10 ); %END;
11%mend;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.