BookmarkSubscribeRSS Feed
Fluorite | Level 6

Hi all,

In the attached document you can see an example of the table summarizing patients adverse events within different visits in hospitals. VISITDT is a visit date. term2 is adverse event verbatim. columns DATE_ONSET(=start date) and DATE_END are still not populated. I put each visit in different color. And I took as example "hyperuricemia" which I highlighted in red color, to explain my problem. You can see that this patient #1 had hyperuricemia in all visits, except on the visit on 22.jan.2016. Thus, in my final table I would like to have only 2 rows for hyperuricemia (including max INTENSITY):

1st row: term2=hyperuricemia DATE_ONSET=31.dec.2015 DATE_END=18.jan.2016 INTENSITY=Grade 4

2nd row: term2=hyperuricemia DATE_ONSET=15.feb.2016 DATE_END=23.mar.2016 INTENSITY=Grade 3 (Severe)

Basically I know how to have first and last date with proc sort, but my main problem is how to take into account the interruptions. Please could anyone help? I think program should look row by row, and if no hyperuricemia then it should take the previous VISITDT as end date. Then when program see hyperuricemia again it should take VISITDT as a new DATE_ONSET, and so on... THANK YOU!


dates interruptions.jpg


Super User

Please supply your data as data steps with datalines, as you were shown in Then give an example of the exepected result.

Do not post MS Office attachments, as these are often blocked against download and/or display with the previewer of the SAS website. If it is necessary to post screenshots, use the "Photos" button.


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 2 in conversation