if index_year=1990 then &name.0=&name.1990; Hi all, I am a relatively new SAS user and currently working with longitudinal data. In order to shape my data I am running a number of repetitive commands daily. For example, I need to assign time point depending on the index year. If index year is 1990, then timepoint starts from 1990. I have many variables and 28 time points and this makes my codes are just so bulky. Do you have any suggestions how I can apply macros or loops to save space and writing time? Thank you. %let name=_alcdep; DATA db; set db; if index_year=1990 then &name.1=&name.1991; if index_year=1990 then &name.2=&name.1992; if index_year=1990 then &name.3=&name.1993; if index_year=1990 then &name.4=&name.1994; if index_year=1990 then &name.5=&name.1995; ... if index_year=1991 then &name.0=&name.1991; if index_year=1991 then &name.1=&name.1992; if index_year=1991 then &name.2=&name.1993; if index_year=1991 then &name.3=&name.1994; if index_year=1991 then &name.4=&name.1995; .... run;
... View more