28%macro mm_updatestpsourcecode(stp=
36%let tsuri=stopifempty ;
39 format type uri tsuri value $200.;
40 call missing (of _all_);
41 path=
"&stp.(StoredProcess)";
43 if metadata_pathobj(
"",path,
"StoredProcess",type,uri)>0 then
do;
46 do while (metadata_getnasn(uri,
"Notes",cnt,tsuri)>0);
47 rc=metadata_getattr(tsuri,
"Name",value);
48 %
if &mdebug=1 %then %
do;
51 if value=
"SourceCode" then
do;
53 rc=metadata_getattr(tsuri,
"Id",value);
54 call symputx(
'tsuri',value,
'l');
63%
if &tsuri=stopifempty %then %
do;
64 %put %str(WARN)ING: &stp.(StoredProcess) not found!;
68%
if %length(&stpcode)<2 %then %
do;
69 %put %str(WARN)ING: No SAS code supplied!!;
74%let frefin=%mf_getuniquefileref();
75%let frefout=%mf_getuniquefileref();
80 put
"<UpdateMetadata><Reposid>$METAREPOSITORY</Reposid>
81 <Metadata><TextStore id='&tsuri' StoredText='";
86%
if %length(&stpcode)>2 %then %
do;
88 file &frefin lrecl=32767 mod;
89 infile &stpcode lrecl=32767;
93 outstr=tranwrd(_infile_,
'&',
'&');
94 outstr=tranwrd(outstr,
'<',
'<');
95 outstr=tranwrd(outstr,
'>',
'>');
96 outstr=tranwrd(outstr,
"'",
''');
97 outstr=tranwrd(outstr,
'"',
'"');
98 outstr=tranwrd(outstr,
'0A'x,
'
');
99 outstr=tranwrd(outstr,
'0D'x,
'
');
100 outstr=tranwrd(outstr,
'$',
'$');
101 %
if &minify=YES %then %
do;
104 if not (outstr=:
'/*' and subpad(left(reverse(outstr)),1,2)=
'/*');
113 put
"'></TextStore></Metadata><NS>SAS</NS><Flags>268435456</Flags>
117proc metadata in= &frefin out=&frefout;
120%
if &mdebug=1 %then %
do;
123 infile &frefout lrecl=32767;
129 filename &frefin clear;
130 filename &frefout clear;
133%mend mm_updatestpsourcecode;