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

Hi,

I need help with creating a flag whenever there is the first occurrence of value >180, and order the subsequent values that are >18 

Have:

iddateValue
1First_date113
2next_297
3next_386
4next_4138
5next_5193
6next_690
7next_7197

want:

 

iddateValueFlag > 180 values in that order
1First_date1130
2next_2970
3next_3860
4next_41380
5next_51931
6next_6900
7next_71972

Thank you, I will appreciate your help.

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Here is one way:

data want (drop=counter);
  set have;
  if value gt 180 then counter+1;
  flag=ifn(value gt 180,counter,0);
run;

Art, CEO, AnalystFinder.com

 

View solution in original post

2 REPLIES 2
art297
Opal | Level 21

Here is one way:

data want (drop=counter);
  set have;
  if value gt 180 then counter+1;
  flag=ifn(value gt 180,counter,0);
run;

Art, CEO, AnalystFinder.com

 

AZIQ1
Quartz | Level 8
Thank you so much, it worked!!!!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1281 views
  • 1 like
  • 2 in conversation