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
if 'new event'n eq 'Yes' then counter + 1;
if 'new event'n eq 'Yes' then counter + 1;
Brilliant, Thanks!!
/Thomas
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.