BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bollibompa
Quartz | Level 8


Hi,

I want to create a variable that enumerate each observation with one defined condition("Yes")

I have tried _N_ but nedd to add a if/where clause but this is not possible.

I want my table to look like this (a new count when New event="Yes") and if possible a retain for the last Count when New event="No"

Id                         New event      counter            

1                           Yes               1

1                           Yes               2

2                           Yes               3

2                           No                3

2                           No                3

2                           No                3

2                           Yes              4

3                           Yes              5

Thanks

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

if 'new event'n eq 'Yes' then counter + 1;

View solution in original post

2 REPLIES 2
data_null__
Jade | Level 19

if 'new event'n eq 'Yes' then counter + 1;

bollibompa
Quartz | Level 8

Brilliant, Thanks!!

/Thomas

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
  • 2 replies
  • 556 views
  • 3 likes
  • 2 in conversation