Hi all,
I've got a working Metadata query (code below) but I can't manage to define a filter so that the respond XML contains less information.
The working query is here.
filename myinput temp lrecl=256;
filename myoutput '~/test.xml' lrecl=256;
/*filename myoutput temp lrecl=256;*/
data _null_;
file myinput;
input;
put _infile_ ' ';
datalines;
<GetMetadata>
<Metadata>
<Job Id="A5LSNX1U.BU0001H8"/>
</Metadata>
<NS>SAS</NS>
<!--OMI Flags 1 + 2 + 2048 -->
<Flags>2051</Flags>
<Options/>
</GetMetadata>
;
run;
proc metadata
in=myinput
out=myoutput;
run;
The only information I really need per Job:
All TextStore objects with attributes ID and StoreText.
Example: <TextStore Id="A5LSNX1U.AG0007ZF" StoredText="%inc 'path user written';" />
Context
I'm working on a large migration project with lots of DIS jobs who use a lot of user written code with fully hard coded paths (don't ask!).
Some of the paths will have to change in the target environment (and no, we can't keep them the same using symlinks).
Environment is Rhel both source and target. SAS version is from source 9.4 to target 9.4 (latest maintenance release).
What I'm trying to do:
1. Pull out all the user written hard coded paths from the source metadata environment
2. Manually create a mapping sheet source path to target path (where paths change)
3. Write code which uses this mapping sheet and changes the user written paths in target Metadata after .spk's have been imported into the target environment.
I'm currently working on step 1. I could make things work with what I have already but it would help if I could reduce the size of the response XML.
Here the same query using the SMC XML Metadata Interface
Patrick,
There are several ways to do this. You could try an XMLMap and map the data. You could change the Get metadata to only get the fields you want. like
proc metadata
in=myinput
out=myoutput (keep=xxxxx, yyyyy);
run;
You could read the XML back into a SAS dataset and then do what you want to it:
libname jobs xml '/data/jobs.xml'; proc datasets library=jobs; run;
proc .....
There are some nice examples here: https://go.documentation.sas.com/api/docsets/lrmeta/9.4/content/lrmeta.pdf
Andy
What you propose is what I'm currently doing. I use an XML map and read the response XML into SAS tables, I then select the tables with the info I need (TextStore, TextStore1, TextStore<n>).
What I'm after is a request XML that returns a smaller response XML/less data. I've also consulted the docu you've posted but I didn't manage to define such a request XML.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.