BookmarkSubscribeRSS Feed
statadm
Fluorite | Level 6
Yes, essentially, I have to rearrange the time variables (no matter the location) until they match based on the criteria I indicated. But, I do have to keep the 13 additional variables associated with the time variables when I reorder the times. In the end, I have to actually compare the 13 variables to one another (13 variables for Time1-Time37 and compare the Timef1-Timef37), not the times. The times are just being used to match up the correct events. This is for a reliability study. I'm trying to get some help from a fellow programmer because this is taking me too long 🙂


Message was edited by: statadm
Flip
Fluorite | Level 6
I did it this way;
Transpose your data and split it such that you have a data set time with:
ID Time Var1 - Var13
data set timef with
ID TimeF
Do a cartesian join;

create table diff as
select time.*, timef.timef , abs(time-timef) as diff, min(abs(time-timef) as mindif
from time, timef where time.id = timef.id
group by time.id, time;

now select diff.* from diff where diff = mindif;

You now have the time difference on the rows with all of your variables with times matched to the closest timef. If diff is more than 5 or 15 you can drop that row.
statadm
Fluorite | Level 6
Thank you all for your recommendations. I actually do have a code that works now. I appreciate everyone's input so much.

The code is pretty long, so I'm not going to post it unless anyone is interested in seeing it.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 17 replies
  • 2044 views
  • 0 likes
  • 5 in conversation