Hi I just have a very simple question for a code I used before but just wouldn't work now. Basically I just wanted to use %do year %to year to stack up a series of data sets from multiple years. The example I'm using below is just for 3 years. For some reasons the following code isn't working data combined; set %do year = 2009 %to 2011; d&year %end;; run; and would give me error messages "%DO statement is not valid in open code" and pointed to d&year as - Syntax error, expecting one of the following: a name, a quoted string, (, -, :,;, END, INDSNAME, KEY, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_. - The symbol is not recognized and will be ignored. Same data are below. Thanks a great deal. data d2009; input id; datalines; 1 2 4 ; data d2010; input id; datalines; 3 5 ; data d2011; input id; datalines; 3 6 ; data combined; set %do year = 2009 %to 2011; d&year %end;; run;
... View more