BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Babloo
Rhodochrosite | Level 12

I want to create one variable called DESCRIPTION which should have the value as description of the Job. Assume one Job is calculating weight of the student and it is mentioned in the description of the Job, then I need the value as "weight of the student" in a variable DESCRIPTION.

 

I already checked the generated code of the DIS Jobs and no Job holds the value of the description of the Job in any macro variable neither it don't seem to be stored any where.

 

Appriciate if someone of you shed some light on this exercise.

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

@Babloo 

Full points that you first inspected the DIS generated code to see what's available. You might have seen that DIS creates macro variable &JobID. Using this macro variable the following should work.

data _null_;
  length Description $256;
  rc=metadata_getattr("OMSOBJ:Job?@Id = '&jobID'","Desc",Description);
  call symputx('Description', Description);
  put rc=;
  put Description=;
  stop;
run;

%put &=Description;

Above based on docu sample code from here:

https://go.documentation.sas.com/?docsetId=lrmeta&docsetTarget=p1kjy5liyi86w8n1vfopazyeb70u.htm&docs... 

 

And to figure out the attribute names for a metadata object refer to documentation here:

https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#job.htm 

 

Querying SAS Metadata is often not that simple. Luckily here we just had to get the attribute of an object where we knew the Id already. 

View solution in original post

3 REPLIES 3
Babloo
Rhodochrosite | Level 12
Should I use Metadata_Appprop data step function?
Patrick
Opal | Level 21

@Babloo 

Full points that you first inspected the DIS generated code to see what's available. You might have seen that DIS creates macro variable &JobID. Using this macro variable the following should work.

data _null_;
  length Description $256;
  rc=metadata_getattr("OMSOBJ:Job?@Id = '&jobID'","Desc",Description);
  call symputx('Description', Description);
  put rc=;
  put Description=;
  stop;
run;

%put &=Description;

Above based on docu sample code from here:

https://go.documentation.sas.com/?docsetId=lrmeta&docsetTarget=p1kjy5liyi86w8n1vfopazyeb70u.htm&docs... 

 

And to figure out the attribute names for a metadata object refer to documentation here:

https://support.sas.com/documentation/cdl/en/omamodref/67417/HTML/default/viewer.htm#job.htm 

 

Querying SAS Metadata is often not that simple. Luckily here we just had to get the attribute of an object where we knew the Id already. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 3 replies
  • 756 views
  • 1 like
  • 3 in conversation