Finding the last nonblank value in an observation

Accepted Solution Solved
Reply
Super Contributor
Posts: 279
Accepted Solution

Finding the last nonblank value in an observation

I want to find the last nonblank value in all observations. The vars are listed in the COALESCE statement below.  I assume that COALESCE will find the first nonblank value but I also want to find the last nonblank value in the list without having to list multiple IF statements.

data join1a;

set join1;

first_MAP=coalesce(F07_ptile,S08_ptile,F08_ptile,S09_ptile,F09_ptile,S10_ptile,F10_ptile,S11_ptile,F11_ptile,S12_ptile);

S12_ptile ne . then current_MAP=S12_ptile;

.
.

.

;


Accepted Solutions
Solution
‎02-13-2013 10:56 AM
Super User
Posts: 19,850

Re: Finding the last nonblank value in an observation

What about listing the variables in reverse order in another coalesce statement?

View solution in original post


All Replies
Solution
‎02-13-2013 10:56 AM
Super User
Posts: 19,850

Re: Finding the last nonblank value in an observation

What about listing the variables in reverse order in another coalesce statement?

Super Contributor
Posts: 279

Re: Finding the last nonblank value in an observation

Thanks!

🔒 This topic is solved and locked.

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

Discussion stats
  • 2 replies
  • 204 views
  • 0 likes
  • 2 in conversation