Real-Time Entity and Network Generation Action Set

Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds

This section contains PROC CAS code.

Note: Input data must be accessible in your CAS session, either as a CAS table or as a transient-scope table. A CAS table has a two-level name: the first level is your CAS engine libref, and the second level is the table name. You refer to this table in the CAS procedure by specifying only the second level. For more information about two-level names, see Chapter 2, Shared Concepts (SAS Viya: Machine Learning Procedures). A transient-scope table is called directly from the action and exists in memory for the duration of the action. For more information about accessing data, see SAS Viya: System Programming Guide. For more information about PROC CAS and programming in CASL, see SAS Cloud Analytic Services: CASL Programmer’s Guide and SAS Cloud Analytic Services: CASL Reference.

This example illustrates how to use the queryCompounds action to generate entities and networks for specific documents. The example assumes that you have already run Example 32.2.

data mycas.query_compounds;
   infile datalines dsd;
   length compound_value $32. compound_type $32.;
   input compound_value $ compound_type $;
   datalines;
JAMES~MORRIS~11769, namedob
;
proc cas;
   action rteng.queryCompounds /                                     /* 1 */
      compounds = {
         {compoundValue="JAMES~MORRIS~11769" compoundType="namedob"} /* 2 */
      }
   /* compounds = {{name="query_compounds"}}                            2 */
      output = {name="query_compounds_out" replace=true}             /* 3 */
      outputCompoundValue = true                                     /* 4 */
      outputSubEntityId = true                                       /* 5 */
      softDeleteEntities = {                                         /* 6 */
         {
            entityType="address"                                     /* 7 */
            temporalSplitting=true
            hasAttribute={{attribute="role" value="business"}}
         }
      }
      softDeleteLinks = {                                            /* 8 */
         {
            documentType="claim"                                     /* 9 */
            entityType="individual"
            hasAttribute={{attribute="role" value="supplier"}}
         }
         {
            documentType="claim"
            entityType="address"
            hasAttribute={{attribute="role" value="supplier"}}
         }
      }
      ;
   run;
quit;

Specific lines of the code (as numbered in the comments) are described as follows:

  1. The queryCompounds action from the rteng action set is being called.

  2. The list of compounds to query is specified; alternatively, a table that contains the compounds to query is specified.

  3. The name of the output table that contains the networks is specified.

  4. Setting the outputCompoundValue parameter to TRUE results in the compound values being part of the output. This is useful for understanding why entities have formed and for understanding the data that are used to form them.

  5. Setting the outputSubEntityId parameter to TRUE results in the _subentity_id_ column being included in the output. This is useful for understanding why an entity has been temporally split into multiple subentities.

  6. The list of entity soft-deletes is specified.

  7. The address entity is soft-deleted when the role of the address is business. Setting the temporalSplitting parameter to TRUE indicates that this address can be temporally split. For this to work, the validFrom and validTo parameters must have been specified in the entity definition during the createCompoundStore action (see Example 32.1).

  8. The list of link soft-deletes is specified.

  9. The link between the claim document and the individual entity is soft-deleted when the role of the individual in the claim is that the individual is the supplier.

Output 32.5.1 is the output table of the queryCompounds action. It contains a row for each compound that is formed on each network for the specific documents being queried. The compounds are grouped into entities; the grouping is denoted by the _entity_id_ variable. The links between entities and documents are grouped into networks; the grouping is denoted by the _network_id_ variable.

Output 32.5.1: queryCompounds Output Table

_network_id_entity_type_entity_id__subentity_id__soft_delete_document_typedocument_idrecord_idcompound_typecompound_valueROLEvalid_fromvalid_to
1INDIVIDUAL100claimCLAIM001CP101SSN12345CLAIMANT..
1INDIVIDUAL100claimCLAIM001CP101NAMEDOBJAMES~MORRIS~11769CLAIMANT..
1INDIVIDUAL100claimCLAIM001CP101NAMEADDRESSMORRIS~199 BISHOPSGATE~EC2M 3TYCLAIMANT..
1INDIVIDUAL100claimCLAIM004CP302SSN12345CLAIMANT..
1INDIVIDUAL100claimCLAIM004CP302NAMEDOBPHILLIP~MARTINEZ~9914CLAIMANT..
1INDIVIDUAL100policyPOLICY001POLICY001SSN12345 22MAY201815OCT2233
1INDIVIDUAL100policyPOLICY001POLICY001NAMEDOBJAMES~MORRIS~11769 22MAY201815OCT2233
1INDIVIDUAL100policyPOLICY004POLICY004SSN98123 27OCT201415OCT2233
1INDIVIDUAL100policyPOLICY004POLICY004NAMEADDRESSMARTINEZ~45 RICHBORNE TERRACE~SW8 1AT 27OCT201415OCT2233
1INDIVIDUAL100policyPOLICY004POLICY004NAMEDOBPHILLIP~MARTINEZ~9914 27OCT201415OCT2233
1INDIVIDUAL201claimCLAIM001CP103NAMEDOBDOROTHY~GONZALEZ~9045SUPPLIER..
1INDIVIDUAL201claimCLAIM001CP103NAMEADDRESSGONZALEZ~JH AUTOS STRATTON DRIVE~SE25 3LSSUPPLIER..
1INDIVIDUAL300claimCLAIM001CP102SSN23456THIRD_PARTY..
1INDIVIDUAL300claimCLAIM001CP102NAMEADDRESSHARENBERG~406 ACRE LANE~SE15 3TYTHIRD_PARTY..
1INDIVIDUAL300claimCLAIM001CP102NAMEDOBSTEVEN~HARENBERG~11045THIRD_PARTY..
1ADDRESS401claimCLAIM001CP101STREETPOSTCODE199 BISHOPSGATE~EC2M 3TYBUSINESS26APR201815OCT2233
1ADDRESS401claimCLAIM001CP101STREETCITY199 BISHOPSGATE~LONDONBUSINESS26APR201815OCT2233
1ADDRESS520claimCLAIM001CP101STREETCITY136 BRIXTON ROAD~LONDONRESIDENTIAL22MAY201815OCT2233
1ADDRESS520claimCLAIM001CP101STREETPOSTCODE136 BRIXTON ROAD~SW9 7UPRESIDENTIAL22MAY201815OCT2233
1ADDRESS520policyPOLICY001POLICY001STREETCITY136 BRIXTON ROAD~LONDON 22MAY201815OCT2233
1ADDRESS520policyPOLICY001POLICY001STREETPOSTCODE136 BRIXTON ROAD~SW9 7UP 22MAY201815OCT2233
1ADDRESS600policyPOLICY004POLICY004STREETCITY45 RICHBORNE TERRACE~LONDON 27OCT201415OCT2233
1ADDRESS600policyPOLICY004POLICY004STREETPOSTCODE45 RICHBORNE TERRACE~SW8 1AT 27OCT201415OCT2233
1ADDRESS700claimCLAIM001CP102STREETCITY406 ACRE LANE~LONDONRESIDENTIAL..
1ADDRESS700claimCLAIM001CP102STREETPOSTCODE406 ACRE LANE~SE15 3TYRESIDENTIAL..
1ADDRESS801claimCLAIM001CP103STREETCITYJH AUTOS STRATTON DRIVE~LONDONSUPPLIER..
1ADDRESS801claimCLAIM001CP103STREETPOSTCODEJH AUTOS STRATTON DRIVE~SE25 3LSSUPPLIER..


Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds

This example is not available for the Lua programming language.

Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds

This example is not available for the Python programming language.

Using the queryCompounds Action to Generate Entities and Networks for Specific Compounds

This example is not available for the R programming language.

Last updated: August 04, 2026