<?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: Modify - Error object failure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443435#M282763</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer. Your idea about&amp;nbsp;UPDATEMODE=NOMISSINGCHECK is correct, perhaps i do not want to overwrite the others observations. When i say overwrite others observations, is to put them for missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i had a problem with statement BY variable because in my situation i do not wanted to change&amp;nbsp;all observations. I wanted to update&amp;nbsp;one variable but with a condition. In my situation a had to create a new&amp;nbsp;table(new collumns)&amp;nbsp;with new values that i want to update because only create observations that i want and not overwrite the others, next merge vertically&amp;nbsp;and then filter the observations that i want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it was a stupid idea but worked fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aleixo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2018 17:45:58 GMT</pubDate>
    <dc:creator>Aleixo</dc:creator>
    <dc:date>2018-03-07T17:45:58Z</dc:date>
    <item>
      <title>Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442461#M282757</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to update all observations with a condition. If i have a newer date and for the same Tag. I did a search and i may mixed sql and sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;date is in format 05Mar2018 Date9. and Tag is a string&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
	modify mydata adddata;
	by date;
	if (adddata.date ge mydata.date 
AND adddata.Tag eq mydata.Tag) then replace;
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and i have this error:&lt;/P&gt;&lt;P&gt;ERROR: DATA STEP Component Object failure.&amp;nbsp; Aborted during the COMPILATION phase.&lt;BR /&gt;ERROR 557-185: Variable adddata is not an object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can i do with this correct by someone or i have other options?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aleixo&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 18:23:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442461#M282757</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-03-05T18:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442609#M282758</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/191516"&gt;@Aleixo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to update all observations with a condition. If i have a newer date and for the same Tag. I did a search and i may mixed sql and sas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;date is in format 05Mar2018 Date9. and Tag is a string&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
	modify mydata adddata;
	by date;
	if (adddata.date ge mydata.date 
AND adddata.Tag eq mydata.Tag) then replace;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and i have this error:&lt;/P&gt;
&lt;P&gt;ERROR: DATA STEP Component Object failure.&amp;nbsp; Aborted during the COMPILATION phase.&lt;BR /&gt;ERROR 557-185: Variable adddata is not an object.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can i do with this correct by someone or i have other options?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Aleixo&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You likely need to have a different variable for the BY statement since you are saying that you want to update date values in the mydata set. It looks like Tag would be the likely candidate. The BY DATE says to match the records on the value of DATE and that appears not to be what you want.&lt;/P&gt;
&lt;P&gt;Some example data might help make a better suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you use things like "adddata&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date" in statements other than set, modify, merge, update&amp;nbsp;or data in a datastep .and are not using a Hash object then SAS thinks this is SCL programming. If you reread the syntax examples for MODIFY I think you will not find any that use the SCL syntax.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2018 20:11:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442609#M282758</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-05T20:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442693#M282759</link>
      <description>&lt;P&gt;1. The dot notation in data steps is only used for library.table names, or for objects (such as hash tables).&lt;/P&gt;
&lt;P&gt;2. It makes no sense to&amp;nbsp;ask for equality (BY statement) and then test for inequality&lt;/P&gt;
&lt;P&gt;3. You are after something like this. Modify as required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data MYDATA;
  modify MYDATA ADDDATA(rename=(DATE=NEWDATE));
  by TAG;
  if NEWDATE ge DATE then replace;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Mar 2018 01:28:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442693#M282759</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-03-06T01:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442815#M282760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it is a good ideia your code. But i have a problem in mydata. Some of adddata not exist in mydata. i must change "manually" because is an error of my data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The TRANSACTION data set observation does not exist on the MASTER data set.&lt;BR /&gt;ERROR: No matching observation was found in MASTER data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to ignore when Tag does not exist in master data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My adddata is something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NewDate      Tag
01Mar2018   XXXX-1000
02Mar2017   XXXX-1001
03Mar2017   XXXX-1002
04Mar2017   XXXX-1003
05Mar2017   XXXX-1004
06Mar2017   XXXX-1005&lt;BR /&gt;06Mar2017&amp;nbsp;&amp;nbsp; XXXX-1006&lt;BR /&gt;06Mar2017&amp;nbsp;&amp;nbsp; XXXX-1007

Date            Tag
01Jan2017   XXXXY1001
02Mar2015   XXXX-1002
03Mar2018   XXXX-1003
04Mar2016   XXXX-1004
05Mar2018   XXXX-1005
06Mar2017   XXXX-1006
06Mar2018   XXXX-1007&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;For exame the first mydata is an error because it not suppose to appear "Y". it was suppose to appear "-". It is that cause the SAS error because the program not ignore.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For that reason my ideia was test when newTag equal Tag&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 09:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442815#M282760</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-03-06T09:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442821#M282761</link>
      <description>&lt;P&gt;Thank you your answer. you are right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My main problem is the Statement By for partial correlation, because i want to update the date with newdate for a partial correlation of Tag, like final 4 or 5 characters, or in other case for the first 2 words match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was difficult to do that because the statement By is only for when string match perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, you have an example of my data in the other post&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 10:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/442821#M282761</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-03-06T10:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443008#M282762</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/191516"&gt;@Aleixo&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is a good ideia your code. But i have a problem in mydata. Some of adddata not exist in mydata. i must change "manually" because is an error of my data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ERROR: The TRANSACTION data set observation does not exist on the MASTER data set.&lt;BR /&gt;ERROR: No matching observation was found in MASTER data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to ignore when Tag does not exist in master data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For that reason my ideia was test when newTag equal Tag&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Perhaps you should investigate UPDATE instead of MODIFY. The transaction data set for update does not have to have a record for every master.&lt;/P&gt;
&lt;P&gt;UPDATE will add records if the BY variable exists in the transaction set but not the master set or new variables.&lt;/P&gt;
&lt;P&gt;If you have missing values you want applied to the master use UPDATEMODE=NOMISSINGCHECK.&lt;/P&gt;
&lt;P&gt;And if there are multiple transactions for the same master record all are applied.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 19:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443008#M282762</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-06T19:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443435#M282763</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your answer. Your idea about&amp;nbsp;UPDATEMODE=NOMISSINGCHECK is correct, perhaps i do not want to overwrite the others observations. When i say overwrite others observations, is to put them for missing values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i had a problem with statement BY variable because in my situation i do not wanted to change&amp;nbsp;all observations. I wanted to update&amp;nbsp;one variable but with a condition. In my situation a had to create a new&amp;nbsp;table(new collumns)&amp;nbsp;with new values that i want to update because only create observations that i want and not overwrite the others, next merge vertically&amp;nbsp;and then filter the observations that i want.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think it was a stupid idea but worked fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Aleixo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2018 17:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443435#M282763</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-03-07T17:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443445#M282764</link>
      <description>&lt;P&gt;I am not sure I totally follow your use case but it sounds like this to me.&lt;/P&gt;
&lt;P&gt;You have an existing table and a dataset that might have new records or update records.&amp;nbsp; If so then it sounds like you just need to use this type of logic that is mentioned in the manual pages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;You can use OUTPUT and REPLACE in this example of conditional logic because only one of the REPLACE or OUTPUT statements executes per observation:&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data master;
   modify master trans; by key;
   if _iorc_=0 then replace;
   else
      output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Mar 2018 18:14:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443445#M282764</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-07T18:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Modify - Error object failure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443695#M282765</link>
      <description>&lt;P&gt;Hi Tom, it is a very good idea that code for modify only observations that i want with a condition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But now i take the opportunity to ask you if it is possible to do that but with the Statement By different. I show you example of my data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NewDate      Tag
01Mar2018   XXXX-1000
02Mar2017   XXXX-1001
03Mar2017   XXXXY1002
04Mar2017   XXXX-1003
05Mar2017   XXXXY1004
06Mar2017   XXXX-1005
06Mar2017   XXXX-1006
06Mar2017   XXXXY1007

Date            Tag
01Jan2017   XXXX-1001
02Mar2015   XXXX-1002
03Mar2018   XXXX-1003
04Mar2016   XXXX-1004
05Mar2018   XXXX-1005
06Mar2017   XXXX-1006
06Mar2018   XXXX-1007&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I can not modify my data BY Tag because the Tag is a "little" diferent. The goal was update for example 1002 and 1004.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My solution&amp;nbsp;was create a new table/data and transform Tag different and put them with the right name(transform Y to -) and after that merge vertically and filter repeated Tags by newer Date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you understand what i mean?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Aleixo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 09:38:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Modify-Error-object-failure/m-p/443695#M282765</guid>
      <dc:creator>Aleixo</dc:creator>
      <dc:date>2018-03-08T09:38:20Z</dc:date>
    </item>
  </channel>
</rss>

