## Data step

Occasional Contributor
Posts: 18

# Data step

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
Super User
Posts: 10,239

## Re: Data step

And what is the logical rule for the intended result?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 13,542

## Re: Data step

What are you "counting"?

Posts: 5,529

## Re: Data step

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```
PG
Contributor
Posts: 37

## Re: Data step

What is that you want to accomplish?

PROC Star
Posts: 8,164

## Re: Data step

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

Discussion stats
• 5 replies
• 259 views
• 0 likes
• 6 in conversation