Date: Fri, 22 Jun 2007 11:41:31 -0400 Paul Miller "SAS(r) Discussion" Paul Miller Coding Problem: Combining Records Based on a Set of Criteria / A Difficult Lead Problem?? cc: Robert Bardos <200706221306.l5MD2iLk021832@mailgw.cc.uga.edu> text/plain; charset="us-ascii"

Hi Robert,

Thanks very much for your helpful reply. I'm not in a position to work on this again until Monday. But I can see how your code can easily be modified to meet the first criterion. And I think I may have some ideas about how to meet the second criterion as well.

The main problem I may have with the second criterion is with getting SAS to look forward an undetermined number of rows. For example, suppose that the final value for HAART in the HAVE dataset were a 0 instead of a 1. Then in row 4 of the HAVE data, I would need SAS to recognize that a) the patient is on HAART, b) the patient goes off HAART in the next row, c) the patient does not go back onto HAART again. At that point, I would need SAS to just output the HAART regimen in row 4 and not to try and combine it with the other non-HAART regimens that follow.

Similarly, suppose that the second to last value for MAX_DURATION were changed from a 2 to a 40. Then in row 4 of the HAVE data, I would need SAS to recognize that a) the patient is on HAART, b) the patient goes off HAART in the next row, c) the patient does in fact go back onto HAART again, but d) they may have been off HAART for as many as 50 days (a MAX_DURATION of 10 days + a MAX_DURATION of 40 days). At that point, I would again need SAS to just output the regimen because the potential time the patient was off HAART is > 14 days.

So my question now concerns whether there is a way to get SAS to look forward like this, especially when the number of rows to look forward would depend on some set of criteria. I was thinking that one way to approach the problem would be simply to reverse sort the data by START and then to determine whether or not there was a subsequent HAART regimen and/or the time that the patient was off HAART. My sense is that SAS would then plunk this information down in the right location (e.g., row 4 of the original HAVE dataset). Is this the best way to go in your opinion? Or can you see a more elegant way of doing it?

Thanks,

Paul

Paul J. Miller, Ph.D. Research Scientist and Statistician Ontario HIV Treatment Network 1300 Yonge St., Suite 308 Toronto, Ontario M4T 1X3 Phone: (416) 642-6486 ext 232 Fax: (416) 640-4245

Back to: Top of message | Previous page | Main SAS-L page