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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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