We help IT Professionals succeed at work.
Get Started

Numbering items for each subgroup within a larger list

hantran99
hantran99 asked
on
462 Views
Last Modified: 2013-11-16
Hi,

I am looking for a way in SAS to do the following.

Say you have the following dataset

cust_number  transno
A   abc123
A   def456
A   fed666
B  bbb444
B  ttt567
B  ert444
B eee444
C tyk333
C kyt567

I would like to number all the records for each customers as follows:
cust_number  transno  transcounter
A   abc123  1
A   def456   2
A   fed666   3
B  bbb444  1
B  ttt567    2
B  ert444   3
B eee444   4
C tyk333  1
C kyt567  2

As you can see, I want to be able to number of observations in each subgroup (in this case customers)  1, 2, 3, 4 and so on and then restart from 1 again for the next customer or subgroup and so. How can I accomplish this in SAS.
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE