Hey I need some help formatting some data I was recently given.
I need to see all the days the customer had the product. Is there an easy way to do this or do I need to write some loops?
Can't really see the end product. But if you want that desired output, I think a do-loop is the tool.
After outputting a row for each date, re-sort the table on customer, possession_date and product, and then use a data step with BY and first./last.-logic to create your desired output.
input customer$ product$ purchase_date : mmddyy10. days_supply;
format purchase_date mmddyy10.;
a R1 10/11/13 30
a R2 10/11/13 30
b R1 02/15/13 30
b R2 03/15/13 30
b R3 04/15/13 60
do possession_date= purchase_date to intnx('day',days_supply,purchase_date);
format possession_date mmddyy10.;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.