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!!!!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 1488 views
  • 1 like
  • 2 in conversation