/*=============================================================================== SAS PROGRAM: This program is to create CVC_VET_STATUS variable The QNAMES required: MILC1 /*'YEMP_MILCODE.01_2021'*/ MILC2 /*'YEMP_MILCODE.02_2021'*/ MILC3 /*'YEMP_MILCODE.03_2021'*/ MILC4 /*'YEMP_MILCODE.04_2021'*/ MILC5 /*'YEMP_MILCODE.05_2021'*/ MILC6 /*'YEMP_MILCODE.06_2021'*/ MILC7 /*'YEMP_MILCODE.07_2021'*/ MILC8 /*'YEMP_MILCODE.08_2021'*/ MILC9 /*'YEMP_MILCODE.09_2021'*/ MILC10 /*'YEMP_MILCODE.10_2021'*/ CVC_VET_r19 /*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_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*/ ===============================================================================*/ array mil milc:; do i=1 to dim(mil); if mil[i]=0 then mil[i]=14; end; %let n=10; %let lastcvc=CVC_VET_r19; array MILC(&n); CVC_VET=0; active=0; reserve=0; guard=0; if &lastcvc=1 then CVC_VET=1; * Was active duty last XRND, keep active duty; do I=1 to (&n); if MILC[I] in (1,2,3,4,11) then do; * Active duty this round; active=1; if CVC_VET=0 then do; CVC_VET=1; * if was previously non-Veteran, and now active duty, then code CVC_VET as 1; end; end; end; if CVC_VET ne 1 and &lastcvc=2 then CVC_VET=2; * Not active duty this round, was reserves last XRND, keep reserves; 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; *was in NG last time, and not in active duty or reserves this time, keep NG; do I=1 to (&n); if MILC[I] in (9,10) then do; * GUARD ; guard=1; if CVC_VET=0 then do; CVC_VET=3; * not vet last time, NG this time; 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; data vet.r20vets; set three; keep pubid cvc_vet; rename cvc_vet=CVC_VET_STATUS; run;