/*=============================================================================== SAS PROGRAM: This program is to create CVC_VET_STATUS variable The QNAMES required: MILC1 /*'YEMP_MILCODE.01_2023'*/ MILC2 /*'YEMP_MILCODE.02_2023'*/ MILC3 /*'YEMP_MILCODE.03_2023'*/ MILC4 /*'YEMP_MILCODE.04_2023'*/ MILC5 /*'YEMP_MILCODE.05_2023'*/ MILC6 /*'YEMP_MILCODE.06_2023'*/ MILC7 /*'YEMP_MILCODE.07_2023'*/ MILC8 /*'YEMP_MILCODE.08_2023'*/ MILC9 /*'YEMP_MILCODE.09_2023'*/ CVC_VET_r20 /*CVC_VET_STATUS*/ /* Definition of YEMP_MILCODE variable 1=Army 2=Navy 3=Air Force 4=Marine Corps 11=Coast Guard 5=Army Reserves 6=Navy Reserves 7=Air Force Reserves 8=Marine Corps Reserves 12=Coast Guard Reserves 9=Air National Guard 10=Army National Guard 13=Other (SPECIFY) 14=Non-Military Job*/ /* Definition of created variable cvc_vet=CVC_VET_STATUS 0=Did not serve in armed forces 1=Served in Active armed forces 2=Served in the Reserves 3=Served in the National Guard*/ %let n=10; %let lastcvc=CVC_VET_r20; array MILC(&n); CVC_VET=0; active=0; reserve=0; guard=0; if &lastcvc=1 then CVC_VET=1; do I=1 to (&n); if MILC[I] in (1,2,3,4,11) then do; active=1; if CVC_VET=0 then do; CVC_VET=1; end; end; end; if CVC_VET ne 1 and &lastcvc=2 then CVC_VET=2; do I=1 to (&n); if MILC[I] in (5,6,7,8,12) then do; reserve=1; if CVC_VET=0 then do; CVC_VET=2; end; end; end; if CVC_VET not in (1,2) & &lastcvc=3 then CVC_VET=3; do I=1 to (&n); if MILC[I] in (9,10) then do; guard=1; if CVC_VET=0 then do; CVC_VET=3; end; end; if (MILC[I] in (-1, -2, -3, 13) or &lastcvc=-3 ) & CVC_VET=0 then do; CVC_VET=-3; end; if MILC1=-5 and &lastcvc=-4 then do; CVC_VET=-4; end; end;