Hi:
I am still confused. You seem to be using the terms "column", "variable" and "page" in a different manner than I'm used to thinking about it. At one point your post says that "each page contains one variable", but then you have (in your comments) that "this macro will print each data set being each page" and then further down "start loop to cycle through each Page to get print it". I guess I don't understand how you're using the term "page" because it almost seems like you're either equating every variable with a "page" or every data set with a "page".
Also, it looks to me like you have an error in your code. The RENAME dataset option requires parentheses and if you had a KEEP and a RENAME for the same dataset, then you would follow this model: [pre]
data mydata(keep = var1 var2 var3 rename=(currvar= newvar));
[/pre]
If I were going to write a macro program to generate a proc print for every variable in SASHELP.CLASS (my original example). I would generate it as shown in the code below. I did not use CALL EXECUTE, because for my example, I didn't need to. If all I want to do is generate a separate PROC PRINT for every column in a dataset, then I just need to find out the names of the columns in my dataset of interest. If I'm going to use a macro program so I can have a %DO loop, there's no reason to add the overhead of CALL EXECUTE, because all I want are the PRINTS. Note that I have only printed 3 obs per variable in order to minimize the amount of text posted to the forum. Program and output is shown below. The line of **************** signals a page break or new page.
Without a clear picture of either the INPUT data set or the OUTPUT you desire, I am unable to comment on your solution. If your code is generating the results you want, then that's good. If you seek to make your program more efficient or your issue is with EG limits, then you might wish to consider working with Tech Support.
cynthia
The Macro program:
[pre]
%macro prtmany(lib=, dsn= );
proc sql noprint;
select count(name) into :numcols
from dictionary.columns
where libname ="%upcase(&LIB)" and memname ="%upcase(&DSN)" ;
quit;
%let numcols = &numcols;
%put numcols is: &numcols;
proc sql noprint;
select name into :col1-:col&numcols
from dictionary.columns
where libname ="%upcase(&LIB)" and memname ="%upcase(&DSN)" ;
run;
quit;
options nodate number pageno=1 ls=64;
%do i = 1 %to &numcols;
%put -----> col&i is &&col&i;
title "One PROC PRINT for Every Column in &LIB..&DSN.";
title2 "This column is: &&col&i";
proc print data=&lib..&dsn.(obs=3) label;
var &&col&i ;
run;
%end;
%mend prtmany;
[/pre]
The macro invocation:
[pre]
ods listing;
%prtmany(lib=sashelp, dsn=class);
[/pre]
The output (***** show "page" breaks in LISTING):
[pre]
One PROC PRINT for Every Column in sashelp.class 1
This column is: Name
Obs Name
1 Alfred
2 Alice
3 Barbara
*****************************************************************
One PROC PRINT for Every Column in sashelp.class 2
This column is: Sex
Obs Sex
1 M
2 F
3 F
*****************************************************************
One PROC PRINT for Every Column in sashelp.class 3
This column is: Age
Obs Age
1 14
2 13
3 13
*****************************************************************
One PROC PRINT for Every Column in sashelp.class 4
This column is: Height
Obs Height
1 69.0
2 56.5
3 65.3
*****************************************************************
One PROC PRINT for Every Column in sashelp.class 5
This column is: Weight
Obs Weight
1 112.5
2 84.0
3 98.0
[/pre]