BookmarkSubscribeRSS Feed
yaakov555
Fluorite | Level 6

How can I create a counter in a select statement for a unique ID?

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Use a data step, not SQL

--
Paige Miller
Tom
Super User Tom
Super User

@yaakov555 wrote:

How can I create a counter in a select statement for a unique ID?


By using normal SAS code.

data want;
  id+1;
  set have;
run;
Reeza
Super User

monotonic() but depends on the query exactly. 

 

 

PGStats
Opal | Level 21

What would your counter be counting?

PG
yaakov555
Fluorite | Level 6

1,2,3,4,5

PaigeMiller
Diamond | Level 26

@yaakov555 wrote:

1,2,3,4,5


Those are the numbers that the counter produces. It does not explain what is being counted.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1427 views
  • 2 likes
  • 5 in conversation