07-14-2015 11:48 AM
I can't resolve this problem. I have a list of clients visits in a three months period and I need to count those visits one per client and per week. I have only today and last week's Friday dates and the dates of the clients visits.
How can I list one visit per client and per week in SAS Enterprise Guide?
Thanks for your help!
07-14-2015 12:43 PM
Do you have any rule such as the earliest or latest visit or do you require a single random selection if there are more than one visit per week?
07-15-2015 09:58 AM
It can be the earliest visit. I don't have a specific rule for that, I just want to count one visit per week.
07-15-2015 11:11 AM
Here is one way. A format to create groups by week within client and count, then count the result.
proc format library=work;
picture yearweek (default=8)
other= '%Y/%0U' (datatype=date);
proc freq data=have noprint;
tables client * date /list norow nocol nopercent out=temp;
format date yearweek. ;
The set TEMP will have one record per client per week.
You haven't provide an example of what the final output(s) might look like but you can get a total of clients per week by summarizing the Temp dataset variable date. A count of client would give you the total unique clients in the data.
proc freq data=temp;
07-14-2015 01:00 PM
Look at the SORT Task in EG and the unique options there.
You may need to sort twice, the first time to get the data in the order you want and the second so you can take the first record.