Hi:
I'm not sure what you mean by using a do loop to create the data sets.
There are 2 ways to create data set with a DATA step program:
1) read "raw" data using INFILE/INPUT to create your output data set
2) read an existing SAS dataset using a SET statement (you can also read a DBMS file with the right SAS/Access product)
If you are reading data with a SET statement and you want to output to differently numbered datasets based on a value, such as YEAR,
you don't really need a do loop to accomplish this task:
[pre]
data sale93 sale94 ;
set sashelp.prdsale;
if year = 1993 then output sale93;
else if year = 1994 then output sale94;
run;
proc print data=sale93;
title '1993 Sales';
run;
proc print data=sale94;
title '1994 Sales';
run;
[/pre]
If, for example, the data had the possibility of 1990-1999, but some years were not in the data and you wanted to programmatically run a data step
program for each year, then the way to accomplish that might best be in a macro program.
It really depends on what you want to do.
cynthia