Help with returning the last non-missing value

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Help with returning the last non-missing value

Hello everyone,

I have a total of 56 possible dates variables (CDfour1, CDfour2, CDfour3, etc.) where patients visited the clinic to have their CD4 value determined. Not every patient will have a total of 56 dates, so may have been loss to follow up (i.e. stopped coming to the clinic, etc.) I need to determine the last date each patient came into the clinic. I know the COALESCE function returns the FIRST non-missing value for a variable, but is there a function that returns the LAST non-missing value? Will the COALESCE function work for this? Thanks.

Kelly


Accepted Solutions
Solution
‎12-11-2012 04:21 PM
Super Contributor
Posts: 1,636

Re: Help with returning the last non-missing value

Posted in reply to kelly6984

can you get what you want by using:

date=max(of cdfourSmiley Happy;

View solution in original post


All Replies
Solution
‎12-11-2012 04:21 PM
Super Contributor
Posts: 1,636

Re: Help with returning the last non-missing value

Posted in reply to kelly6984

can you get what you want by using:

date=max(of cdfourSmiley Happy;

Respected Advisor
Posts: 3,156

Re: Help with returning the last non-missing value

Very nice, Linlin!

Haikuo

Occasional Contributor
Posts: 15

Re: Help with returning the last non-missing value

Posted in reply to kelly6984

It worked!! Thank you so much...YOU ROCK!!!

🔒 This topic is solved and locked.

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

Discussion stats
  • 3 replies
  • 189 views
  • 0 likes
  • 3 in conversation