BookmarkSubscribeRSS Feed
Laugeoe
Calcite | Level 5

Dear all.

I hope one of you can help me.

 

I have an observation for every diagnosis given to a patient.

I have a variable called removal (if the patient has been removed to another hospital on the same day the patient has been discharge from the first hospital).

 

I would like to find out if the diagnosis given at the first hospital is the same as the diagnosis given at the second hospital.

 

Example of my dataset

 

ID     Diag            Admission      Discharge      Removal

1       DI451         Date               Date               0/1

1       ...               ....                   ....                  ....

1       ...

1       ...

2       ...

2       ...

2

 

Can anybody please give an advise?

 

Best regards

Laugeoe

4 REPLIES 4
Reeza
Super User

You need to post sample data and what you'd like to see as the output. 

Laugeoe
Calcite | Level 5
Dear Reeza.
I would like a new variable 0/1 that states if the diagnosis was the same at the two hospitals (1) or if there were a discrepancy..
Reeza
Super User

Ok, somehow join the record to the previous record (SQL Join) or sort your data and use LAG to retrieve the diagnosis code.

If the diagnosis is different set it to 0, otherwise set it to 1. 

 

 

 

 

PGStats
Opal | Level 21

Your data is missing hospitaID: the hospital where the diagnosis was given. That would make the data much easier to interpret.

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 4 replies
  • 830 views
  • 0 likes
  • 3 in conversation