lundi 20 août 2018

Nested If-then inside do loop

Is it possible to write SAS code to do the following:

For each account
     Get numRec
     For i = 1 to numRec
          Get location(i)
          Get location(i + 1)
          Get account(i)
          Get Account(i + 1)
          If account(i + 1) = account(i) Then
               If location(i) = ICU and location(i + 1) = LLOC Then
                    Get transaction_stop(i)
                    Get transaction_stop(i + 1)
                    j = 1
                    do until orig_order_dt_tm(j) >= transaction_stop(i)
                         If order_detail(j-1) <> PACU and order_detail(j-1) <> ICU Then
                              order_dt_tm(i) = orig_order_dt_tm(j-1)
                         end;
                         j = j + 1;
                    end;
               end;
          end;
     end;
end;

Aucun commentaire:

Enregistrer un commentaire