DATA Step, Macro, Functions and more

create a iteration in a group

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

create a iteration in a group

Here is the original data

class

1

1

1

1

1

1

3

3

3

4

4

4

4

And I would like to create a new variable which counts the number in each group.

class    count

1               1

1               2

1               3

1               4

1               5

1               6

3               1

3               2

3               3

4               1

4               2

4               3

4               4

I think I may use first. last.variable to get the count.But I still don't know how to write the code...Could you help me?


Accepted Solutions
Solution
‎07-03-2015 01:54 PM
Super User
Posts: 17,885

Re: create a iteration in a group


All Replies
Solution
‎07-03-2015 01:54 PM
Super User
Posts: 17,885

Re: create a iteration in a group

Contributor
Posts: 31

Re: create a iteration in a group

thank you very much

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 178 views
  • 0 likes
  • 2 in conversation