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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.