Hello,
I'd like to use a SAS array to create variables for every second year and then populate these variables. Using the example below, I'd like for the created variables to only include the even years from 1992 to 2006, for a total of 8 variables. Currently, I have to create variables for all years from 1992 to 2006, and then drop the odd numbered years.
I don't believe that a nested loop - where, for example, i = 1 to 8 - solves my problem, but please correct me if I am wrong. I think that I need the array index to only be factoring in values 1992, 1994, 1996, 1998 ...2006. This would allow the array index value to equal the _BASEYR value for which I am evaluating the expression, and populate the correct item in the array with a TRUE/FALSE value. Is it possible to specify an array index that precisely?
*CREATE THE CALENDAR YEARS;
ARRAY FPB_CY (1992:2006) FPB_CY1992 - FPB_CY2006;
DO J = 1992 TO 2006 BY 2;
IF _BASEYR = J THEN FPB_CY{J}= 1;
ELSE FPB_CY{J} = 0;
END;
DROP FPB_CY1993 FPB_CY1995 FPB_CY1997 FPB_CY1999 FPB_CY2001 FPB_CY2003 FPB_CY2005;
Thank you!
Preeti
... View more