Hi there,
We have structure like Folder--->Jobs------>Data . Out of this I can see data in folders but how to find the exact jobs on server. These data tables are registered by using Proc Metalib so I can view them but how to find out if jobs are not registered.I need to list out the jobs. To be specific, is there any way to find out without creating the SPK ??? I hope that I am clear and making sense
Look at proc metadata
%let xfile = %nrquote(<<Output XML FILE>>.xml);
filename myinput temp lrecl=256;
filename myoutput xfile lrecl=256;
options metapass="<<USERNAME>>"
metaport=<<PORT>>
metaprotocol=bridge
metarepository="<<REPOSNAME>>"
metaserver="<<METASERVERADDRESS>>"
metauser="<<PASSWORD>>";
data _null_;
file myinput;
input;
put _infile_ ' ';
datalines;
<GetMetadataObjects>
<Reposid><<ID OF YOUR METADATA REPOSITORY>></Reposid>
<Type>Job</Type>
<Objects/>
<NS>SAS</NS>
<Flags>401</Flags>
<Options>
</Options>
</GetMetadataObjects>
;;
run;
proc metadata
in=myinput
out=myoutput
header=full;
run;
Use the SAS XML Mapper to create a .map file and save it. After that, issue a libname statement using the xml libname engine. This creates a library which you can query like any other sas datasets. I've attached a default map for you.
filename mymap = %nrquote(<<FILENAME and PATH of MAP FILE>>);
libname xfile xml xmlmap=mymap;
This will return all jobs. If you need Deployed Jobs, replace the Type in the GetMetadataObjects with the type of "JFJob". You can also use filters in GetMetadata to only show jobs with the ID's you mentioned. Details are on support.sas.com.
Cam
Unless you deploy the job for scheduling the job is defined in the SAS metadata server and not in a physical drive. That means the job structure is stored in tables as opposed to .sas files like you would in base/SAS or EG etc. If you need to view job definitions you need to either query the metadata server using metadata functions or proc metadata. If you have deployed your job for scheduling then the job defaults generally to your sas config directory under batch jobs.
Thanks a lor CameronL .... One more question... can u help me out in printing job names in Enterprise guide ... See I have jobs with Ids as A35467U.12G,A35467U.169 and A35467U.144 .. how do I print the corresponding object name in Base SAS ... I know getattr function can be used here but how to is something I am really confused.. can u plz show some direction
Look at proc metadata
%let xfile = %nrquote(<<Output XML FILE>>.xml);
filename myinput temp lrecl=256;
filename myoutput xfile lrecl=256;
options metapass="<<USERNAME>>"
metaport=<<PORT>>
metaprotocol=bridge
metarepository="<<REPOSNAME>>"
metaserver="<<METASERVERADDRESS>>"
metauser="<<PASSWORD>>";
data _null_;
file myinput;
input;
put _infile_ ' ';
datalines;
<GetMetadataObjects>
<Reposid><<ID OF YOUR METADATA REPOSITORY>></Reposid>
<Type>Job</Type>
<Objects/>
<NS>SAS</NS>
<Flags>401</Flags>
<Options>
</Options>
</GetMetadataObjects>
;;
run;
proc metadata
in=myinput
out=myoutput
header=full;
run;
Use the SAS XML Mapper to create a .map file and save it. After that, issue a libname statement using the xml libname engine. This creates a library which you can query like any other sas datasets. I've attached a default map for you.
filename mymap = %nrquote(<<FILENAME and PATH of MAP FILE>>);
libname xfile xml xmlmap=mymap;
This will return all jobs. If you need Deployed Jobs, replace the Type in the GetMetadataObjects with the type of "JFJob". You can also use filters in GetMetadata to only show jobs with the ID's you mentioned. Details are on support.sas.com.
Cam
Thanks a lot... it solved the purpose...
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.