Published on :

Sans titre

This code is also available in: Deutsch Español Français
1 Code Block
PROC FORMAT
Explanation :
Macro definition that iterates over the input string to construct the VALUE statement for a PROC FORMAT. It generates a key-value mapping for a character format ($).
Copied!
1%macro AHGautoformat(str,fmt,dlm=/,quote=);
2 %local fmtN;
3 %let fmtN=%AHGcount(&str,dlm=/);
4 %local i item;
5 %DO i=1 %to &fmtN;
6 %let item=%scan(&str,&i,&dlm);
7 %local value&i FORMAT&i;
8 %AHGpop(item,value&i);
9 %let FORMAT&i=&item;
10 %END;
11 PROC FORMAT;
12 value $&fmt
13 %DO i=1 %to &fmtN;
14 "&&value&i"="&&format&i"
15 %END;
16 ;RUN;
17 
18 
19%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.