BookmarkSubscribeRSS Feed
BTAinRVA
Quartz | Level 8

I have a table with patient info that has two flag variables, app_flag which indicates the patient had a diagnosis for appendicitis within 30 days of an appendectomy procedure, and chronic_flag which flags those patients that had a diagnosis of a chronic disease within 180 days of an appendectomy procedure. This table will have multiple records for a patient and the two flags may occur in different records. What I want is a table with one row per patient with the two flag variables indicating if they have ever had the flag in any of their records. It is now coming to mind as I write this that maybe a Proc SQL select distinct patid and summing the flag variables (as they are coded 0 and 1).

 

Any thoughts?

2 REPLIES 2
GreggB
Pyrite | Level 9

This article has an example of creating a data set with one observation per subject from a data set that has multiple obs per subject.

 

http://www2.sas.com/proceedings/sugi24/Advtutor/p48-24.pdf

 

 

 

BTAinRVA
Quartz | Level 8

Thanks! That is great stuff.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 821 views
  • 0 likes
  • 2 in conversation