You have two mistakes.
The main one is that you are not including the period in the generated filename. The period you have is being used by the macro processor so that it knows that the macro variable is named I and IDTA. So you need another one to become part of the filename.
The other are missing semi-colons at the end of two of your macro statements. Macro statements end with semi-colons just like regular SAS statements.
%macro prep;
%local i;
%do i=1998 %to 2015;
PROC IMPORT DATAFILE = "X:\Rawdata\IND&i..dta"
OUT = WORK.IND&i
DBMS=STATA replace
;
RUN;
%end;
%mend;
%prep;
... View more