I have two datasets formatted as so: Dataset1 ID Day1 Day2 Day3 Day4 Day5 1 10/12/2013 10/11/2013 10/10/2013 10/09/2013 10/08/2013 2 11/09/2013 11/08/2013 11/07/2013 11/06/2013 11/05/2013 … Dataset2Dates, Matching, Multiple Datasets Date Value 10/07/2013 5 10/08/2013 10 10/09/2013 3 10/10/2013 7 …. Both are very large datasets (thousands of records). I would like to match by date between the datasets (Day1 and Date, Day2 and Date, etc.) and bring the Value associated with the matched date in Dataset2 into Dataset1 for that ID (or create a new dataset with Dataset1 info with the new values for each date). I would like to do that for each ID in Dataset 1 for Day1-Day5. Ultimately, resulting in something like this for all IDs and their associated Days in order to bring the values associated with that date into the dataset with the IDs: DatasetX? ID Day1 Day1Value Day2 Day2Value … 1 10/12/2013 5 10/11/2013 3 … 2 11/09/2013 8 11/08/2013 20 …. I've experimented with bringing the second dataset into the first and making dummy variables, but it won't work as of yet. Example: data work.test1; set work.test; format Day1 MMDDYY10. Date MMDDYY10. Day2 MMDDYY10.; if Day1=Date then DAY1Value=Value; if Day2=Date then DAY2Value=Value; run; I've experimented with proc sql as well, but only successful one date at a time (with such large data this isn't feasible), whereas I need to do this for multiple dates at once to bring multiple values over based on those dates. Example: proc sql; create table test3 as select * from Dataset1, Dataset2 where Day1=Date ; quit; I have yet to try do loops, but not sure how to put that together. Any help is GREATLY appreciated. Thank you! Note, I am using SAS 9.4.
... View more