Hi All,
I have below sample data set and I would like to get the desire result as follows.
data test;
input A B C D;
cards;
10 9 13 10
7 7 9 8
6 7 6 8
2 3 3 4
3 4 6 6
6 7 6 7
8 7 7 7
9 8 11 10
9 9 9 9
;
run;
Reslt is as follows
A | B | C | D | Count |
10 | 9 | 13 | 10 | 3 |
7 | 7 | 9 | 8 | 3 |
6 | 7 | 6 | 8 | 3 |
2 | 3 | 3 | 4 | 3 |
3 | 4 | 6 | 6 | 3 |
6 | 7 | 6 | 7 | 4 |
8 | 7 | 7 | 7 | 4 |
9 | 8 | 11 | 10 | 4 |
9 | 9 | 9 | 9 | 4 |
And what is the logical rule for the intended result?
What are you "counting"?
Shouldn't the result be
A B C D Count 10 9 13 10 3 7 7 9 8 3 6 7 6 8 4 2 3 3 4 1 3 4 6 6 3 6 7 6 7 2 8 7 7 7 2 9 8 11 10 4 9 9 9 9 4
What is that you want to accomplish?
If your 'want' represents a card related scoring table, where a pair of numbers-3, and anything greater than 1 pair (e.g., 2 pairs, 3 of a kind, 4 of a kind or a straight=4), then you might want to simply modify the code offered at https://communities.sas.com/t5/SAS-Procedures/Allocating-Values-to-Poker-Hands/td-p/146459
It does all of the above, but was written to evaluate all possible poker hands and rank them according to the rules of poker, but you're only working with 4 cards, don't consider suit, and consider anything greater than a pair to be equal to 4.
Art, CEO, AnalystFinder.com
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.