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.
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 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.