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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.