26%macro mm_updatedocument(path=
35%let tsuri=stopifempty ;
38 format type uri tsuri value $200.;
39 call missing (of _all_);
40 path=
"&path/&name(Note)";
42 if metadata_pathobj(
"",path,
"Note",type,uri)>0 then
do;
45 do while (metadata_getnasn(uri,
"Notes",cnt,tsuri)>0);
46 rc=metadata_getattr(tsuri,
"Name",value);
48 if value=
"&name" then
do;
50 rc=metadata_getattr(tsuri,
"Id",value);
51 call symputx(
'tsuri',value,
'l');
60%
if &tsuri=stopifempty %then %
do;
61 %put %str(WARN)ING: &path/&name.(Document) not found!;
65%
if %length(&text)<2 %then %
do;
66 %put %str(WARN)ING: No text supplied!!;
70filename &frefin temp recfm=n;
78 if _n_=1 then put
"<UpdateMetadata><Reposid>$METAREPOSITORY</Reposid>
79 <Metadata><TextStore id='&tsuri' StoredText='" @@;
81 when (
'&') put '&';
82 when ('<') put '<';
83 when ('>') put '>';
84 when ("'") put ''';
85 when ('"') put '"';
86 when ('0A'x) put '&
#x0a;';
87 when (
'0D'x) put
'
';
88 when (
'$') put '&
#36;';
89 otherwise put instr $CHAR1.;
95 put
"'></TextStore></Metadata><NS>SAS</NS><Flags>268435456</Flags>
100filename &frefout temp;
102proc metadata in= &frefin
103 %
if &mdebug=1 %then out=&frefout verbose;
107%
if &mdebug=1 %then %
do;
110 infile &frefout lrecl=1048576;
116%mend mm_updatedocument;