Hi, I am trying to merge two datasets: dataset A and dataset B, and at the same time, I want to do some calculations based on the TOTAL and the LOS_TOTAL. I tried to merge the data set by year as it is the only variable that matches both datasets, but it did not work. I used the following data step:- Data test; Set test1; Merge work.A Work.B; By year; Run; The merge should be based on the value (0,1) for variables (_3WX _2SF _4SQ _6SR _7SF _7WO 7ICU _5AA), if the value is 1 then take the same values of GRE and ZDF from the dataset B. If it is 0, then ignore it. If one observation contains value 1 in two different variables, then do a calculation. For example (ID 3 has value 1 for _2SF and _7ICU). Now, I am stuck. I don’t know how to merge them. Also, I want to do the following calculation (e.g., ID 3):- If total > 1 then GRE = ZDF = Figure 1 dataset A Figure 2. Dataset B The outcome should be like this:- Figure 3. Desired outcomes Thank you
... View more