27 %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);
    49       if value=
"SourceCode" then 
do;
    51         rc=metadata_getattr(tsuri,
"Id",value);
    52         call symputx(
'tsuri',value,
'l');
    61 %
if &tsuri=stopifempty %then %
do;
    62   %put WARNING:  &stp.(StoredProcess) not found!;
    66 %
if %length(&stpcode)<2 %then %
do;
    67   %put WARNING:  No SAS code supplied!!;
    71 filename &frefin temp lrecl=32767;
    76   put 
"<UpdateMetadata><Reposid>$METAREPOSITORY</Reposid>    77     <Metadata><TextStore id='&tsuri' StoredText='";
    82 %
if %length(&stpcode)>2 %then %
do;
    85     infile &stpcode lrecl=32767;
    89     outstr=tranwrd(_infile_,
'&',
'&');
    90     outstr=tranwrd(outstr,
'<',
'<');
    91     outstr=tranwrd(outstr,
'>',
'>');
    92     outstr=tranwrd(outstr,
"'",
''');
    93     outstr=tranwrd(outstr,
'"',
'"');
    94     outstr=tranwrd(outstr,
'0A'x,
'
');
    95     outstr=tranwrd(outstr,
'0D'x,
'
');
    96     outstr=tranwrd(outstr,
'$',
'$');
    97     %
if &minify=YES %then %
do;
   100       if not (outstr=:
'/*' and subpad(left(reverse(outstr)),1,2)=
'/*');
   109   put 
"'></TextStore></Metadata><NS>SAS</NS><Flags>268435456</Flags>   114 filename &frefout temp;
   116 proc metadata in= &frefin out=&frefout verbose;
   119 %
if &mdebug=1 %then %
do;
   122     infile &frefout lrecl=32767;