Provide example data in the form of a datastep and what the desired result is. Do you need a report that people read or a data set to feed another analysis process?
Since you are talking about date intervals the process will almost certainly work better if your date information is in the form of a SAS date valued variable an not character.
That's an interesting problem ... will have to think about it ... calculating diffs (=date_diff) between dates (in weeks) and setting txn_freq to the lowest value found for each customer_id ... formatting date_diff to show the expected text ... just some initial thoughts.
I see how A is once per month, and B is once per week, given the intervals between records. But there is no interval for C since it has only one record. So why is it termed "2 months once"?
State your rules.
You now have 2 C records, one in April and one in June. So how are we to know why you call this once per 3 months?
Please clearly state the criteria you use to infer each possible frequency. For an effective coding solution, a clear specification of the requirements is needed.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.