0

I've the below dataset as input

ID category cust.nr cust.name income

1 a 100 Crosbie 5000
2 a 200 Heier 5500
2 a 300 Pick 5500
3 a 400 Sandridge 5100
4 b 500 Groesbeck 10000
4 b 600 Hayton 11000
4 b 700 Razor 12000
5 c 800 Lamere 90000

I need a report (f.ex using proc tabulate) as follows

In the data, cust.nr are unique but all the customers belonging to one family are given same ID, and customers are categorized based on their income. <10000 as a
10000 to 15000 as b
'>'15000 as c

I need a report with

count of unique IDs(families), grouped by categories, and also rest of the columns need to be shown in the report.

so, it should look like

count_ID category cust.nr cust.name income

-------- ------ 100 Crosbie 5000
-------- ------ 200 Heier 5500
3 a 300 Pick 5500
-------- ------ 400 Sandridge 5100

-------- ------ 500 Groesbeck 10000
1 b 600 Hayton 11000
-------- -------- 700 Razor 12000

1 c 800 Lamere 90000

Any suggestions please..

1
  • Your question is far too vague to even attempt an answer. I see no connection between the first dataset and the second. What are you trying to do?
    – JDB
    Jun 12, 2013 at 16:46

1 Answer 1

0

You can do this easily with proc sql:

proc sql noprint;
  create table results as
  select category,
         count(distinct id) as count_id
  from mytable
  group by 1
  ;
quit;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.