Provide generic rules. Examples provided for specific patients do not provide a general rule that I could apply to other patients that do not have exactly the same values for the given variables.
You might find the WHICHC function helpful. It will return the position of number of the first value if found in a list of values/variables.
whichc (Plan_trt, of c(*))
would return the position of the value of Plan_trt if found in the array c or 0 if not found. So a 3 would mean that what ever value of Plan_trt may have was found in VIS5 given your array C definition.
Are the variables shown the only ones? I ask because the naming convention with VIS2 VIS4 VIS5 VIS6 VIS21 VIS51 VIS41 might indicate many missing variables such as VIS10 or VIS22 through VIS40.
If they are the only variables then the "all" case may be easiest as
if VIS2= VIS4= VIS5= VIS6= VIS21= VIS51= VIS41=Plan_TRT then Final_Actual_trt= Plan_trt ;
But I am not sure that when you say "all" that I am interpreting that as you might intend.
Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712 will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the </> icon or attached as text to show exactly what you have and that we can test code against.
... View more