SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Identify first and subsequent data value in rows

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 81
Accepted Solution

Identify first and subsequent data value in rows

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.


Accepted Solutions
Solution
‎04-07-2018 12:30 AM
PROC Star
Posts: 8,150

Re: Identify first and subsequent data value in rows

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


All Replies
Solution
‎04-07-2018 12:30 AM
PROC Star
Posts: 8,150

Re: Identify first and subsequent data value in rows

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

 

Frequent Contributor
Posts: 81

Re: Identify first and subsequent data value in rows

Thank you so much, it worked!!!!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

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