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

Hi,

 

I am trying to generate SAS DI jobs because they are processed in an external tool, but I want to see the complete data lineage in SAS.

So, the current situation is: Staging => Data Vault => Logic Data Model => Data Marts

All but staging to data vault is built in SAS DI Studio. I want to create "dummy" job to generate data lineage from data vault to staging.

 

This is my code so far:

DATA work.kip ;
  LENGTH uri_job uri_TA uri_TS uri_CM uri_TXT uri_CO $64. ;

  * Create new objects ;
    rc = metadata_newobj('Job', uri_job, '_Voorbeeldje', 'Foundation') ;
    rc = metadata_newobj('TransformationActivity', uri_TA, 'TransKip', 'Foundation') ;
    rc = metadata_newobj('TransformationStep', uri_TS, 'User Written', 'Foundation') ;
    rc = metadata_newobj('ClassifierMap', uri_CM, 'UserWrittenKip', 'Foundation') ;
    rc = metadata_newobj('TextStore', uri_TXT, 'TextStoreKip', 'Foundation') ;
    rc = metadata_newobj('CustomAssociation', uri_CO, 'ControlOrder', uri_job, 'CustomAssociations') ;


  * Set attributes ;
    rc = metadata_setattr(uri_job, 'UsageVersion', '1000000') ;
    rc = metadata_setattr(uri_job, 'PublicType', 'Job') ;

  * Locatie toevoegen ;
    * MyFolder: A5NKZYZ3.AA0000CA ;
    rc = metadata_setassn(uri_job, 'Trees', 'Append', 'omsobj:Tree/A5NKZYZ3.AA0000CA') ;

  * AssociatedObjects toevoegen ;
    rc = metadata_setassn(uri_job, 'AssociatedObjects', 'Append', uri_TS) ;

  * TransformationActivity toevoegen ;
    rc = metadata_setassn(uri_job, 'JobActivities', 'Append', uri_TA) ;

  * Tabellen toevoegen ;
  * Test_Class: A5NKZYZ3.BH0004QE ;
  * Test_ClassFit: A5NKZYZ3.BH0004QF ;
    rc = metadata_setassn(uri_TA, 'TransformationTargets', 'Append', 'omsobj:PhysicalTable/A5NKZYZ3.BH0004QE') ;
    rc = metadata_setassn(uri_TA, 'TransformationTargets', 'Append', 'omsobj:PhysicalTable/A5NKZYZ3.BH0004QF') ;

  * TransformationStep toevoegen ;
    rc = metadata_setassn(uri_TA, 'Steps', 'Append', uri_TS) ;
    rc = metadata_setattr(uri_TS, 'UsageVersion', '1000000') ;
    rc = metadata_setattr(uri_TS, 'IsUserDefined', '1') ;
    rc = metadata_setattr(uri_TS, 'TransformRole', 'SASUserExit') ;

  * ControlOrder toevoegen aan TransformationStep ;
    rc = metadata_setassn(uri_TS, 'AssociatedObjects', 'Append', 'omsobj:PhysicalTable/A5NKZYZ3.BH0004QE') ;

  * Nieuwe classifierMap Toevoegen ;
    rc = metadata_setassn(uri_TS, 'Transformations', 'Append', uri_CM) ;
    rc = metadata_setattr(uri_CM, 'IsUserDefined', '1') ;

  * Tabellen toevoegen aan ClassifierMap ;
    rc = metadata_setassn(uri_CM, 'ClassifierSources', 'Append', 'omsobj:PhysicalTable/A5NKZYZ3.BH0004QE') ;
    rc = metadata_setassn(uri_CM, 'ClassifierTargets', 'Append', 'omsobj:PhysicalTable/A5NKZYZ3.BH0004QF') ;

  * Sourcecode toevoegen aan ClassifierMap ;
    rc = metadata_setassn(uri_CM, 'SourceCode', 'Append', uri_TXT) ;   


RUN ;

It generates the job, with the two tables. The data lineage works. However, when I open the job in DI Studio I get the message:

ErrorDI.png

 

I think it has something to do with the creation of the CusomAssociation ControlOrder. When I try to create the CustomAssociation, I get a returncode -2.

 

Can anyone here help me out with this?

1 ACCEPTED SOLUTION

Accepted Solutions
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @ThierryHerrie 

 

 

 

I think you are missing an argument to the  metadata_newobj-function:

 

rc = metadata_newobj('CustomAssociation', uri_CO, 'ControlOrder', uri_job, 'CustomAssociations') ;

rc = metadata_newobj('CustomAssociation', uri_CO, 'ControlOrder', 'Foundation', uri_job, 'CustomAssociations') ;

 

 

 

 

View solution in original post

2 REPLIES 2
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @ThierryHerrie 

 

 

 

I think you are missing an argument to the  metadata_newobj-function:

 

rc = metadata_newobj('CustomAssociation', uri_CO, 'ControlOrder', uri_job, 'CustomAssociations') ;

rc = metadata_newobj('CustomAssociation', uri_CO, 'ControlOrder', 'Foundation', uri_job, 'CustomAssociations') ;

 

 

 

 

ThierryHerrie
Obsidian | Level 7
Hi @ErikLund_Jensen
Thank you so much!! Can't believe I didn't see that myself.
I can create CustomAssociations now 🙂

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1041 views
  • 1 like
  • 2 in conversation