BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
HitmonTran
Pyrite | Level 9

Hi,

 

I have a dataset consisting: customers, food vendors,  and order date .

 

Since customers can order from multiple food vendors within the same day, I need to figure out the frequencies and  %'s  of Vender A,B,C,etc. being ordered together within the same day. 

 

dataset:

Name       Vendor       Order_date

Bob            A               1-1-2020

Bob            A               1-1-2020

Bob            B               1-1-2020

Joe            A                1-2-2020

Joe            B                1-2-2020

Chris         A                 1-1-2020

Chris         B                 1-2-2020

David        C                 1-3-2020

David        A                 1-3-2020

David        B                 1-3-2020

 

 

want:

Vendor_comb       count

A, B                         3

 

 

 

bc Vendor A & B  were ordered 3 times within the same day  from Bob, Joe, David.  Chris does not count bc he ordered on different days.  Thanks

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
HitmonTran
Pyrite | Level 9
it only give me the frequency for each vendors. I need the frequency of the combination (vendor A & B)

View solution in original post

4 REPLIES 4
ballardw
Super User

Try something like:

 

Proc freq data=have;

   tables order_date*vendor / list ;

run;

HitmonTran
Pyrite | Level 9
it only give me the frequency for each vendors. I need the frequency of the combination (vendor A & B)
ballardw
Super User

Incomplete description gives incomplete code.

 

Show ALL of the output you  actually expect given your example data. As it should appear.

You show NO records with both A and B, so your date will need some serious rearranging, and you likely should show the intermediate step so that 'combinations of A and B' exist.

HitmonTran
Pyrite | Level 9
See edited post of "want" and let me know if this is clear. The goal is to find the count of any combination on the same date.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 947 views
  • 0 likes
  • 2 in conversation