Hi everyone,

I have an extra urgent question for you. Here is my situation : I am working on a medical database. In the DB:
- one line corresponds to one diagnosis, so if a patient came to a consultation and received 3 diagnosis, there will be three lines if the database.
- There are two types of medical consultation, psychiatrist and first medical examination. The doctors used on specific diagnosis code to notify the type of consultation. So if the patient came for a fist medical examination there will be one line with a -30 code in the diagnosis variables. That patient will also have other lines with the rest of the actual diagnosis. For one consult on one day, there can be multiples lines in my database.
Thanks to the -30 code (-47 for psychiatrist consult) I was able to create a variable named "type of consultation"with values "Psychiatrist consult" or "FM examination". Here is my question, how can I also apply these values to the other diagnosis line that do not have a -30-47 diagnosis code?
date of consult patient's code doctor's name diagnosis code type of consult
01/01/19 123 Dr.X -30 FM examination
01/01/19 123 Dr.X a21
01/01/19 123 Dr.X b19
15/05/19 124 Dr.Y -47 Psychiatrist consult
15/05/19 124 Dr.Z -30 FM examination
Here is an example.
I'd like to find a code that would fill the missing values in lines 2 and 3 with FM examination if date of consult + patient's code + doctor's name are IDENTICAL.

Can someone please help? thanks !