Hello All,
I have my first dataset which has minimum date(dataset name= agency_based) (column name=min_date)
Second dataset has maximum date(dataset name= self_directed) (column name=max_date)
And i am trying to find difference between these two dates.
Can somebody please help me with this please.
Format of the dates is date9. (ddmmmyyyy)
It may help to describe the contents of your datasets more completely. I would think that the Min_date and Max_date are related to something such as an account name, location, person, activity. Then it would make sense to use that identifying information to link the datasets and then compare the date values.
Sorry for that!
Medicaid_id is the common column in both the datasets.
Now for an obnoxious question, does the same medicaid_id exist more than once in either of the files? If not then something like this
Proc sql;
create table matched as
select agency_based.*, self_directed.*, (self_directed.Max_date - agency_based.Min_date) as date_dif
from agency_based left join self_directed
on agency_based.Medicaid_id = self_directed.Medicaid_id;
quit;
Or sort by data sets and then do a Merge by medicaid_id.
If there are duplicates of the Id variable then there should be more information to link on such as service or provider or something that makes sense that the min and max are related.
One might also ask if both of these sets are derived from a common base data set? There may be some other approaches if that is the case that would not require creating multiple datasets but allows the same comparison.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.