Here is my question: I want to using loop to repeat define step in proc report. Here is my example: *get data; data mydata; set sashelp.class; run; *rename the columns with regular name, like mycol1, mycol2...; %macro rename_col(inset=,outset=); proc sql; create table rename_table_1 as select trim(name)as oldname from dictionary.columns where libname='WORK' and memname=upcase("&inset") ; quit; data rename_table_2; set rename_table_1; nrow=put(_n_,3.); newname=compress(cat("mycol",nrow)); run; proc sql; select cats(oldname,'=',newname) into :myrename separated by ' ' from rename_table_2 ; quit; data &outset; set &inset.(rename=(&myrename)); run; %mend rename_col; %rename_col(inset=mydata,ouset=finaldata); /*loop define step in proc report, like, define mycol1 / "title1"; define mycol2 / "title2";.....*/ proc report data=finaldata; array headers(*) $ ("title1" "title2" "title3" "title4" "title5"); array cols(*) (mycol1 mycol2 mycol3 mycol4 mycol5); do i=1 to dim(headers); define cols(i) / headers(i); end; run; Finally, the code does not work. Array could not be used proc report, excepting compute block. Is there another way to implement this function? Thanks!
... View more