I agree with you mkeintz.
@robertrao :Do you mean:
keep everything that has In and OUT.
delete all if OUT is there but no corresponding IN
fot all same dates where there is IN and no OUT then keep the latest IN and discard all other.
If the above logic is correct follow the following steps:
1. prepare two datasets from the original data - no1. all with IN and OUT
no2. all with In and no OUT
2. then sort the no2. data in descending order of IIN and keep the first.IN - this is your dataset no.3
3. now append no1 and no3.
Since 6 hours is 6 * 60 * 60 = 21600 secs, so something like this:
out between in and (in + 21600)
If you want to calculate using full hours, you could look at the intck() and intnx() functions.
For the logic of last in, if many in without outs, you want to look at first., last. logic paired with retained variables.
Why are these records in your WANT dataset? They don't fit your description as I understand it.
I agree with you mkeintz.
@robertrao :Do you mean:
keep everything that has In and OUT.
delete all if OUT is there but no corresponding IN
fot all same dates where there is IN and no OUT then keep the latest IN and discard all other.
If the above logic is correct follow the following steps:
1. prepare two datasets from the original data - no1. all with IN and OUT
no2. all with In and no OUT
2. then sort the no2. data in descending order of IIN and keep the first.IN - this is your dataset no.3
3. now append no1 and no3.
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.
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.