BookmarkSubscribeRSS Feed
That____Redhead
Fluorite | Level 6

Hey,

I have a regular incoming feed of data, and am using the DATA step with the UPDATE function.

It is a feed of vehicles which have returned for routine maintenance.  When the car is sold, we get records for every covered service period, with an OPEN flag.  The unique variables I am using to update are VIN and Mileage (5k, 10k, etc..).  Then as the service is completed, it moves to COMPLETED.  My problem is, some records are showing back up as OPEN, which is being overwritten.

Ex:

VIN #1 is sold, and it creates all the OPEN records (5 lines) for the 5 different mileage intervals.

As VIN #1 returns for service, I get another record with VIN 1, 5k, and status COMPLETED.

2 weeks later, I get bad data saying VIN 1 at 5k is now OPEN.

Data update will overwrite with bad data.

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.  Can I update Vin 1, 5k, only if the Priority in the new record is greater than the existing record?

Any other thoughts to this issue?  Besides going back to the data team and getting laughed at?

Thanks a ton!

2 REPLIES 2
Reeza
Super User

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...

Workarounds are using a SQL Update instead, using a where to specify which records to selectively update.

ballardw
Super User

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...

By any chance could these completed come from one maintenance issue being resolved but finding that something else is also going on?

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 might correct the issue. So repeat visits on a VIN and mileage may be multiple looks at the car.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 784 views
  • 0 likes
  • 3 in conversation