New Contributor
Posts: 2

# basic problem

can some one help me with the code for this problem ?

`data trans;input CustomerID transactiondate\$ 10. amount category\$;cards;9801234 10/01/1998 123.98 toys9802234 12/10/1997 80.34 books9802234 12/10/1997 100.00 apparel9805556 08/01/1996 22.90 toys9805556 09/10/1996 25.50 apparel9805556 10/11/1996 18.90 books9801134 11/11/1999 12.11 toys ;run;`

Total and average amount spent by category

1. Which category has the highest average purchase
2. What is the average number of categories that customers purchase
3. What is the average and total amount by customer
4. What is the average number of days between purchases (as of today)
Frequent Contributor
Posts: 103

## Re: basic problem

What code have you written?

Norman.
SAS 9.4 (TS1M4) X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation

Posts: 2,802

## Re: basic problem

For numbers 1, 2 and 3, use PROC SUMMARY.

--
Paige Miller
Super User
Posts: 23,237

## Re: basic problem

http://video.sas.com/detail/videos/sas-analytics-u/video/3306906230001/summary-statistics-using-sas-...

http://video.sas.com/detail/videos/sas-analytics-u/video/4573023399001/creating-a-new-column-in-sas?...

hchan10 wrote:

can some one help me with the code for this problem ?

`data trans;input CustomerID transactiondate\$ 10. amount category\$;cards;9801234 10/01/1998 123.98 toys9802234 12/10/1997 80.34 books9802234 12/10/1997 100.00 apparel9805556 08/01/1996 22.90 toys9805556 09/10/1996 25.50 apparel9805556 10/11/1996 18.90 books9801134 11/11/1999 12.11 toys ;run;`

Total and average amount spent by category

1. Which category has the highest average purchase
2. What is the average number of categories that customers purchase
3. What is the average and total amount by customer
4. What is the average number of days between purchases (as of today)

Discussion stats
• 3 replies
• 124 views
• 0 likes
• 4 in conversation