Hello, I have problem with using proc matadata in macro. %let metaserver=xxx;
%let metaport= xxx;
%let metauser= xxx;
%let metapass= xxx;
options metaserver="&metaserver."
metaport=&metaport.
metauser="&metauser."
metapass="&metapass.";
options noquotelenmax;
%macro testmacro(_admin_grp =);
filename resp "/tmp/metafile.xml";
%let test=%str(%'&_admin_grp.%');
%put &test;
proc metadata
in='<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<Objects/>
<NS>SAS</NS>
<Flags>900</Flags>
<Options>
<Templates>
<Person Name=""> <IdentityGroups/> </Person>
</Templates>
<XMLSelect search="*[not(IdentityGroups/IdentityGroup[@Name = '&test'])]"/>
</Options>
</GetMetadataObjects>'
out=resp;
run;
filename mapa temp;
data _null_;
file mapa;
put '<?xml version="1.0" encoding="windows-1250"?> ';
put ' <SXLEMAP version="1.2">';
put ' <!-- ############################################################ -->';
put ' <TABLE description="Type" name="USERS">';
put ' <TABLE-PATH syntax="XPath">/GetMetadataObjects/Objects/Person</TABLE-PATH>';
put ' <COLUMN name="Name">';
put ' <PATH syntax="XPath">/GetMetadataObjects/Objects/Person/@Name</PATH>';
put ' <TYPE>character</TYPE>';
put ' <DATATYPE>string</DATATYPE>';
put ' <LENGTH>100</LENGTH>';
put ' </COLUMN>';
put ' </TABLE>';
put ' </SXLEMAP>';
run;
libname resp xml xmlmap=mapa;
data users;
set resp.users;
run;
%mend;
%testmacro(
_admin_grp = ADMIN
); Log Errors:: SYMBOLGEN: Makro Variable TEST resolved to 'ADMIN' NOTE: Line generated by the macro variable "TEST". 89 (IdentityGroups/IdentityGroup[@Name = ''ADMIN' _ 22 _ 200 MPRINT(TESTMACRO): proc metadata in='<GetMetadataObjects> <Reposid>$METAREPOSITORY</Reposid> <Type>Person</Type> <Objects/> <NS>SAS</NS> <Flags>900</Flags> <Options> <Templates> <Person Name=""> <IdentityGroups/> </Person> </Templates> <XMLSelect search="*[not(IdentityGroups/IdentityGroup[@Name = ''ADMIN''])]"/> </Options> </GetMetadataObjects>' out=resp; MPRINT(TESTMACRO): run; ERROR 22-322: Syntax error, expecting one of the following: ;, HEADER, HOST, ID, IN, INSUREMACHINE, IPADDR, MACHINE, METADATASERVER, METAID, METAPASS, METAPORT, METAPROTOCOL, METAREPOSITORY, METASERVER, METAUSER, METHOD, OUT, PASSWORD, PORT, PROTOCOL, PW, REPOS, REPOSITORY, SERVER, USER, USERID, VERBOSE. ERROR 200-322: The symbol is not recognized and will be ignored. This code works: %let metaserver=xxx;
%let metaport= xxx;
%let metauser= xxx;
%let metapass= xxx;
options metaserver="&metaserver."
metaport=&metaport.
metauser="&metauser."
metapass="&metapass.";
options noquotelenmax;
%macro testmacro(_admin_grp =);
filename resp "/tmp/metafile.xml";
%let test=%str(%'&_admin_grp.%');
%put &test;
proc metadata
in='<GetMetadataObjects>
<Reposid>$METAREPOSITORY</Reposid>
<Type>Person</Type>
<Objects/>
<NS>SAS</NS>
<Flags>900</Flags>
<Options>
<Templates>
<Person Name=""> <IdentityGroups/> </Person>
</Templates>
<XMLSelect search="*[not(IdentityGroups/IdentityGroup[@Name = ''ADMIN''])]"/>
</Options>
</GetMetadataObjects>'
out=resp;
run;
filename mapa temp;
data _null_;
file mapa;
put '<?xml version="1.0" encoding="windows-1250"?> ';
put ' <SXLEMAP version="1.2">';
put ' <!-- ############################################################ -->';
put ' <TABLE description="Type" name="USERS">';
put ' <TABLE-PATH syntax="XPath">/GetMetadataObjects/Objects/Person</TABLE-PATH>';
put ' <COLUMN name="Name">';
put ' <PATH syntax="XPath">/GetMetadataObjects/Objects/Person/@Name</PATH>';
put ' <TYPE>character</TYPE>';
put ' <DATATYPE>string</DATATYPE>';
put ' <LENGTH>100</LENGTH>';
put ' </COLUMN>';
put ' </TABLE>';
put ' </SXLEMAP>';
run;
libname resp xml xmlmap=mapa;
data users;
set resp.users;
run;
%mend;
%testmacro(
_admin_grp = ADMIN
); but I need use macro variable in XMLSelect.
... View more