<?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 Data step Update Question in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120574#M33249</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I have a regular incoming feed of data, and am using the DATA step with the UPDATE function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a feed of vehicles which have returned for routine maintenance.&amp;nbsp; When the car is sold, we get records for every covered service period, with an OPEN flag.&amp;nbsp; The unique variables I am using to update are VIN and Mileage (5k, 10k, etc..).&amp;nbsp; Then as the service is completed, it moves to COMPLETED.&amp;nbsp; My problem is, some records are showing back up as OPEN, which is being overwritten.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VIN #1 is sold, and it creates all the OPEN records (5 lines) for the 5 different mileage intervals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As VIN #1 returns for service, I get another record with VIN 1, 5k, and status COMPLETED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 weeks later, I get bad data saying VIN 1 at 5k is now OPEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data update will overwrite with bad data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My thought: As it is imported, create a new variable (let's call it "priority") and assign a 0 for OPEN and a 1 for COMPLETED.&amp;nbsp; Can I update Vin 1, 5k, only if the Priority in the new record is greater than the existing record?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other thoughts to this issue?&amp;nbsp; Besides going back to the data team and getting laughed at?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Apr 2013 14:50:26 GMT</pubDate>
    <dc:creator>That____Redhead</dc:creator>
    <dc:date>2013-04-25T14:50:26Z</dc:date>
    <item>
      <title>Data step Update Question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120574#M33249</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;I have a regular incoming feed of data, and am using the DATA step with the UPDATE function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is a feed of vehicles which have returned for routine maintenance.&amp;nbsp; When the car is sold, we get records for every covered service period, with an OPEN flag.&amp;nbsp; The unique variables I am using to update are VIN and Mileage (5k, 10k, etc..).&amp;nbsp; Then as the service is completed, it moves to COMPLETED.&amp;nbsp; My problem is, some records are showing back up as OPEN, which is being overwritten.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VIN #1 is sold, and it creates all the OPEN records (5 lines) for the 5 different mileage intervals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As VIN #1 returns for service, I get another record with VIN 1, 5k, and status COMPLETED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 weeks later, I get bad data saying VIN 1 at 5k is now OPEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data update will overwrite with bad data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My thought: As it is imported, create a new variable (let's call it "priority") and assign a 0 for OPEN and a 1 for COMPLETED.&amp;nbsp; Can I update Vin 1, 5k, only if the Priority in the new record is greater than the existing record?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other thoughts to this issue?&amp;nbsp; Besides going back to the data team and getting laughed at?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 14:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120574#M33249</guid>
      <dc:creator>That____Redhead</dc:creator>
      <dc:date>2013-04-25T14:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Data step Update Question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120575#M33250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you're getting some bad data how do you know the rest of the data is good? I think it's always worth asking...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Workarounds are using a SQL Update instead, using a where to specify which records to selectively update. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 15:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120575#M33250</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-25T15:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data step Update Question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120576#M33251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would say allowing a dataset to update an older one without some form of checking for validity might not be a best practice. Especially if the data in question is from human entries...&lt;/P&gt;&lt;P&gt;By any chance could these completed come from one maintenance issue being resolved but finding that something else is also going on?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My dealer can't tell be why my car throws one of the codes periodically but recommends doing about $2,000 worth of work that &lt;STRONG&gt;might&lt;/STRONG&gt; correct the issue. So repeat visits on a VIN and mileage may be multiple looks at the car.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Apr 2013 17:11:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Data-step-Update-Question/m-p/120576#M33251</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-04-25T17:11:30Z</dc:date>
    </item>
  </channel>
</rss>

