Veteran Status - Appendix 2

National Longitudinal Survey of Youth - 1997 Cohort

Veteran Status - Appendix 2

Variable Created

  • CVC_VET_STATUS--indicates whether the respondent has ever served in the active armed forces, the reserves, or the National Guard.

This program uses the military job information from the employer roster to create a variable indicating the respondent's status as a veteran.

Variables Used

/*Variable Names in the Program           Variable Names on the Gator*/  

  PUBID_1997                              'PUBID_1997'n                
  CVC_VET09                               CVC_VET_STATUS_XRND'n       
  MILC01                                  'YEMP_MILCODE.01_2010'n
  MILC02                                  'YEMP_MILCODE.02_2010'n
  MILC03                                  'YEMP_MILCODE.03_2010'n
  MILC04                                  'YEMP_MILCODE.04_2010'n
  MILC05                                  'YEMP_MILCODE.05_2010'n
  MILC06                                  'YEMP_MILCODE.06_2010'n
  MILC07                                  'YEMP_MILCODE.07_2010'n
  MILC08                                  'YEMP_MILCODE.08_2010'n
  MILC09                                  'YEMP_MILCODE.09_2010'n

SAS Code for Variable Creation

%let n=9;
%let lastcvc=CVC_VET09;

array  MILC0(&n) ;  /* 0 is a number like 0,1,2,3 */

CVC_VET=0;
active=0;
reserve=0;
guard=0;

if &lastcvc=1 then CVC_VET=1;

do I=1 to (&n);
  if MILC0[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 MILC0[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 ne 1 and CVC_VET ne 2 and &lastcvc=3 then CVC_VET=3;

do I=1 to (&n);
   if MILC0[I] in (9,10) then do;
      guard=1;
      if CVC_VET=0 then do;
      CVC_VET=3;
     end;
  end;

 if (MILC0[I] in (-1, -2, -3, 13) or &lastcvc=-3) and CVC_VET=0 then do;
    CVC_VET=-3;
  end;
 
 if MILC01=-5 and &lastcvc=-4 then do;
     CVC_VET=-4;
  end;
end;
endsas;