Desktop productivity for business analysts and programmers

I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

Reply
New Contributor
Posts: 2

I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

Hi everyone,

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!

Super User
Posts: 11,129

Re: I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

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?

New Contributor
Posts: 2

Re: I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

It can be the earliest visit. I don't have a specific rule for that, I just want to count one visit per week.

Super User
Posts: 11,129

Re: I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

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);

run;

proc freq data=have noprint;

     tables client * date /list norow nocol nopercent out=temp;

     format date yearweek. ;

run;

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;

tables date;

run;

Super User
Posts: 19,145

Re: I need to count just one visit per client and per week. How can I do that in Enterprise Guide?

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.

Ask a Question
Discussion stats
  • 4 replies
  • 361 views
  • 1 like
  • 3 in conversation