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

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 6 replies
  • 446 views
  • 2 likes
  • 5 in conversation