<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SAS Metadata / DI Studio problem in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597971#M18240</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I saw Properties as something special and didn't realize that - according to the metadata model - a Property is just an Object like all other, and the DefaultValue just an attribute, so it could be set with metadata_setattr.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It took&amp;nbsp; less than one minute to find and correct 776 properties in our test environment, so you just saved me from days of tedious work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 20 Oct 2019 08:58:17 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2019-10-20T08:58:17Z</dc:date>
    <item>
      <title>SAS Metadata / DI Studio problem</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597894#M18235</link>
      <description>&lt;P&gt;Hi experts out there...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a problem with Autopropagate or Automap in DI Studio job transformations. Autopropagation. It is a sure way to get superflous columns propagated through work tables and permanent tables in a whole data warehouse, and our company policy requires these options to be disabled.&lt;BR /&gt;&lt;BR /&gt;In teory they can be disabled in the options settings for Job Editor, but this has no effect on new transformations in a job (SAS DI Studio 4.903 on Windows 10 clients). They still have the settings enabled, and they must be disabled manually in every transformation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is often forgotten or neglected by ETL developers, so it is part of our central quality control. But in a setup with more than 4000 jobs /30.000 transformations and dozens of new or changed jobs every week it is a tedious task, and besides it obscures job responsibility, because the Metadata Modified-by-registration no longer points to the developer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have automated many tasks in our job quality control, e.g. enforcing standardization of formats, but I have not been able to disable occurrences of Autopropagate or Automap with a program. It is not difficult to locate them with a program, but all my efforts to disable them has failed so far.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only way I can figure out is to use the metadata_setprop function like this example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	length inuri outuri $200;
	inuri = "omsobj:PropertySet/A580FNM8.AB00AL75";
	outuri = '';
	rc = metadata_setprop(inuri,"IncludedInPropagation","false",outuri);
	put rc= outuri=;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens is explained in the following cut from the metadata browser. The In-URI points to the OPTIONS object (blue background).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of changing the value of the existing property &lt;STRONG&gt;&lt;EM&gt;IncludedInPropagation&lt;/EM&gt; &lt;/STRONG&gt;associated with &lt;STRONG&gt;&lt;EM&gt;SetProperties&lt;/EM&gt;&lt;/STRONG&gt; (lower blue box), it adds a new property &lt;STRONG&gt;&lt;EM&gt;IncludedInPropagation&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;associated with &lt;STRONG&gt;&lt;EM&gt;Properties&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;(upper blue box), which of course has no effect on the transformation.&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="properties.gif" style="width: 384px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33306i705777E3F3878AEF/image-size/large?v=v2&amp;amp;px=999" role="button" title="properties.gif" alt="properties.gif" /&gt;&lt;/span&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might be expected from the name that the &lt;STRONG&gt;&lt;EM&gt;metadata_setprop&lt;/EM&gt;&lt;/STRONG&gt; function would do exactly that, i.e. add a new property or change an existing Property associated with Properties and not with SetProperties, but that does not solve my problem. How do I write a function call to change the existing property? - any help would be greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2019 14:28:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597894#M18235</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-10-19T14:28:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Metadata / DI Studio problem</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597967#M18238</link>
      <description>&lt;P&gt;Looking into the XML it appears that you need to set DefaultValue="false" for any Property with PropertyName either being&amp;nbsp;IncludedInPropagation or&amp;nbsp;IncludedInMapping&lt;/P&gt;
&lt;PRE&gt;&amp;lt;Property Id="A5LSNX1U.AC006O2R" Name="IncludedInPropagation" DefaultValue="true" PropertyName="IncludedInPropagation" PropertyRole="OPTION" SQLType="16" UseValueOnly="1"/&amp;gt;
&amp;lt;Property Id="A5LSNX1U.AC006O2S" Name="IncludedInMapping" DefaultValue="true" PropertyName="IncludedInMapping" PropertyRole="OPTION" SQLType="16" UseValueOnly="1"/&amp;gt;&lt;/PRE&gt;
&lt;P&gt;Below code returns a table with all the object id's matching above cases. You then could use this information to either generate and execute an UpdateMetadata XML or you use SAS function&amp;nbsp;metadata_setattr()&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename myinput temp lrecl=256;
filename myoutput temp recfm=N;

/***
data _null_;
   file myinput;
   input;
   put _infile_ ' ';
   datalines;
&amp;lt;GetMetadataObjects&amp;gt;
  &amp;lt;Reposid&amp;gt;$METAREPOSITORY&amp;lt;/Reposid&amp;gt;
  &amp;lt;Type&amp;gt;Property&amp;lt;/Type&amp;gt;
  &amp;lt;Objects/&amp;gt;
  &amp;lt;NS&amp;gt;SAS&amp;lt;/NS&amp;gt;
  &amp;lt;!-- OMI_XMLSELECT(128) + OMI_GET_METADATA(256) + OMI_TEMPLATE (4) --&amp;gt;
  &amp;lt;Flags&amp;gt;388&amp;lt;/Flags&amp;gt;    
  &amp;lt;Options&amp;gt;
    &amp;lt;XMLSELECT search="*[@PropertyName = 'IncludedInPropagation' and @DefaultValue='true' or @PropertyName = 'IncludedInMapping' and @DefaultValue='true']"/&amp;gt;
    &amp;lt;Templates&amp;gt;
      &amp;lt;Property Id="" Name="" DefaultValue=""/&amp;gt;
    &amp;lt;/Templates&amp;gt;
  &amp;lt;/Options&amp;gt;
&amp;lt;/GetMetadataObjects&amp;gt;
;
run;
***/


data _null_;
   file myinput;
   input;
   put _infile_ ' ';
   datalines;
&amp;lt;GetMetadataObjects&amp;gt;
  &amp;lt;Reposid&amp;gt;$METAREPOSITORY&amp;lt;/Reposid&amp;gt;
  &amp;lt;Type&amp;gt;Property&amp;lt;/Type&amp;gt;
  &amp;lt;Objects/&amp;gt;
  &amp;lt;NS&amp;gt;SAS&amp;lt;/NS&amp;gt;
  &amp;lt;!-- OMI_XMLSELECT(128) --&amp;gt;
  &amp;lt;Flags&amp;gt;128&amp;lt;/Flags&amp;gt;    
  &amp;lt;Options&amp;gt;
    &amp;lt;XMLSELECT search="*[@PropertyName = 'IncludedInPropagation' and @DefaultValue='true' or @PropertyName = 'IncludedInMapping' and @DefaultValue='true']"/&amp;gt;
  &amp;lt;/Options&amp;gt;
&amp;lt;/GetMetadataObjects&amp;gt;
;
run;

proc metadata method=DoRequest
   in=myinput
   out=myoutput
  ;
run;

filename map temp;
libname myoutput xmlv2 automap=replace xmlmap=map;

options ps=max ls=max;
proc print data=myoutput.property;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If using a SAS data step approach then I believe using table myoutput.property as created above the code to change the value to false could look as simple as below (not tested).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set myoutput.property;
  rc=metadata_setattr(Property_ID, "DefaultValue",  "false");
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2019 06:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597967#M18238</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-20T06:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Metadata / DI Studio problem</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597968#M18239</link>
      <description>&lt;P&gt;Or here another coding option using data step only (not tested). I believe the main difference to what you're doing: There is no attempt to create a new property but it's updating the attribute DefaultValue from true to false.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length uri $256;
  nobj=0;
  nobj=metadata_getnobj("omsobj:Property?(@Name='IncludedInPropagation' or @Name ='IncludedInMapping') AND (@DefaultValue='true')",1,uri);
  do i=1 to nobj;
    rc=metadata_getnobj("omsobj:Property?(@Name='IncludedInPropagation' or @Name ='IncludedInMapping') AND (@DefaultValue='true')",i,uri);
    /* write to metadata - set attribute DefaultValut to false */
/*    rc = metadata_setattr(uri, "DefaultValue", "false");*/

    /* read from metadata - allows to list objects before changing them */
    length DefaultValue $5;
    rc=metadata_getattr(uri,"DefaultValue",DefaultValue);
    output;
  end;
  stop;
run;
proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Added later:&lt;/P&gt;
&lt;P&gt;I've just realized that in the code initially posted the 2nd metadata_getnobj() call was missing. Above code amended accordingly.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2019 21:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597968#M18239</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-10-20T21:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Metadata / DI Studio problem</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597971#M18240</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I saw Properties as something special and didn't realize that - according to the metadata model - a Property is just an Object like all other, and the DefaultValue just an attribute, so it could be set with metadata_setattr.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It took&amp;nbsp; less than one minute to find and correct 776 properties in our test environment, so you just saved me from days of tedious work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Oct 2019 08:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/SAS-Metadata-DI-Studio-problem/m-p/597971#M18240</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-10-20T08:58:17Z</dc:date>
    </item>
  </channel>
</rss>

