05-17-2016 03:11 PM
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)
05-17-2016 03:54 PM
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.
05-17-2016 04:23 PM
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.