1%macro irm_set_fa_sasautos(fa_id =
26 %
if %sysevalf(%superq(mode) =,
boolean) %then %
do;
27 %put WARNING: input parameter MODE is missing. Setting MODE = insert;
31 %let mode = %lowcase(&mode.);
33 %
if(not %sysfunc(prxmatch(/^(insert|append|set)$/i, &mode.))) %then %
do;
34 %put ERROR: invalid parameter MODE = &mode.. Accepted values: insert/append/set;
41 %
if %sysevalf(%superq(limit) =,
boolean) %then
45 %
if %sysevalf(%superq(force_flg) =,
boolean) %then
48 %let force_flg = %upcase(&force_flg.);
50 %
if %sysevalf(%superq(fa_path) =,
boolean) %then %
do;
52 %irm_get_swc_property(swc_name = IRM Mid-Tier Server
53 , property = com.sas.solutions.risk.irm.fa.(?!readonly.)&fa_id.
55 , outvar = swc_property_value
56 , out_ds = irm_federated_areas
57 , pattern_match_flg = Y
61 proc sort data = irm_federated_areas;
62 by descending property_name;
70 %
if(&limit. > 0) %then %
do;
75 call symputx(cats(
"fa_path_", put(_N_, 8.)), cats(property_value,
"/source/sas/ucmacros"),
"L");
77 call symputx(
"TotFas", _N_,
"L");
81 %let TotFas = %sysfunc(countw(%superq(fa_path), %str(,)));
82 %
do i = 1 %to &TotFas.;
84 %let fa_path_&i. = %scan(%superq(fa_path), &i., %str(,));
88 %
if %sysevalf(%superq(outvar_prefix) ne,
boolean) %then %
do;
89 %global &outvar_prefix._count;
90 %let &outvar_prefix._count = &TotFas.;
91 %
do i = 1 %to &TotFas.;
92 %global &outvar_prefix._&i.;
93 %let &outvar_prefix._&i. =
"&&fa_path_&i..";
105 rx1 = prxparse(
"s/[()]/ /");
107 rx2 = prxparse(
"s/[""]/'/");
109 rx = prxparse(
"/(['][^']+['])|(\w+)/");
111 sasautos = getoption(
"sasautos");
113 sasautos = prxchange(rx1, -1, sasautos);
115 sasautos = prxchange(rx2, -1, sasautos);
119 stop = length(sasautos);
120 call prxnext(rx, start, stop, sasautos, position, len);
122 do while (position > 0);
125 path = substr(sasautos, position, len);
127 call symputx(cats(
"sasautos_path_", put(i, 8.)), path,
"L");
129 call prxnext(rx, start, stop, sasautos, position, len);
132 call symputx(
"TotPaths", i,
"L");
137 %let TotFaInsert = 0;
138 %
do i = 1 %to &TotFas.;
139 %let path_to_insert = %sysfunc(prxchange(s/[\\]/\
141 %
if(&force_flg. = N and &mode. ne set) %then %
do;
143 %
do j = 1 %to &TotPaths.;
144 %let path_to_check = %sysfunc(prxchange(s/[\\]/\
145 %let path_to_check = %sysfunc(prxchange(s/[
'']
146 %
if(%bquote(&path_to_insert.) = %bquote(&path_to_check.)) %then
150 %
if(&found. = N) %then %
do;
151 %let TotFaInsert = %eval(&TotFaInsert. + 1);
152 %local fa_insert_path_&TotFaInsert.;
153 %let fa_insert_path_&TotFaInsert. = &&fa_path_&i..;
159 %
if(&TotFaInsert. > 0) %then %
do;
162 %if (%sysfunc(prxmatch(/^(insert|append)$/i, &mode.))
163 and %sysevalf(%superq(insert_before) =,
boolean)
164 and %sysevalf(%superq(insert_after) =,
boolean)
167 &mode. = (sasautos = (
168 %
do i = 1 %to &TotFaInsert.;
169 "&&fa_insert_path_&i.."
179 %let prx_before = %sysfunc(prxchange(s/([\\\/][^\\\/])[\\\/]?$/$1\
180 %let prx_before = %sysfunc(prxchange(s/[\\\/]/\\\
182 %let prx_after = %sysfunc(prxchange(s/([\\\/][^\\\/])[\\\/]?$/$1\
183 %let prx_after = %sysfunc(prxchange(s/[\\\/]/\\\
193 %
do i = 1 %to &TotPaths.;
195 %let path = &&sasautos_path_&i..;
197 %let fwd_path = %sysfunc(prxchange(s/\\/\
199 %let fwd_path = %sysfunc(prxchange(s/[
'']
202 %
if (&processed. = N and %sysevalf(%superq(insert_before) ne,
boolean)) %then %
do;
204 %sysfunc(prxmatch(/^\w+$/, &fwd_path.)) > 0
206 and %qlowcase(&insert_before.) = %qlowcase(&fwd_path.)
210 %sysfunc(prxmatch(/^\w+$/, &fwd_path.)) = 0
212 and %sysfunc(prxmatch(/^&prx_before./, &fwd_path.)) > 0
216 %
do j = 1 %to &TotFaInsert.;
217 "&&fa_insert_path_&j.."
225 %
if(&mode. ne set) %then %
do;
230 %if (&processed. = N and %sysevalf(%superq(insert_after) ne,
boolean)) %then %
do;
232 %sysfunc(prxmatch(/^\w+$/, &fwd_path.)) > 0
234 and %qlowcase(&insert_after.) = %qlowcase(&fwd_path.)
238 %sysfunc(prxmatch(/^\w+$/, &fwd_path.)) = 0
240 and %sysfunc(prxmatch(/^&prx_after./, &fwd_path.)) > 0
244 %
do j = 1 %to &TotFaInsert.;
245 "&&fa_insert_path_&j.."
255 %
if(&processed. = N) %then %
do;
257 %
do j = 1 %to &TotFaInsert.;
258 "&&fa_insert_path_&j.."