BookmarkSubscribeRSS Feed
iSAS
Quartz | Level 8

Let's say I have a data below:

 

data have;
infile cards truncover;
input ID :$4.;
cards;
0196
0196
0196
0395
0752
1277
1277
;
run;

 

What I want is to have a new table with a new column wherein it will count the number of times the ID appeared but not group it. To explain it clearer, I want to have an output like this:

ID        Count_ID
0196          1
0196          2
0196          3
0395          1
0752          1
1277          1
1277          2

 

Could someone help me on this? A program that will work even if ID is not sort by order

1 REPLY 1

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 294 views
  • 0 likes
  • 2 in conversation