Hi all, I have made the following macro but I am getting a error message in the end, someone could help me to know what I'm doing wrong? %MACRO RENAME (dataset1=, dataset2=); PROC SQL; DESCRIBE TABLE LeafL LeafW dictionary.columns; QUIT; PROC SQL; SELECT libname, memname, name FROM dictionary.columns WHERE libname= "WORK" and memname= "&dataset1"; QUIT; PROC SQL; SELECT libname, memname, name FROM dictionary.columns WHERE libname= "WORK" and memname= "&dataset2"; QUIT; PROC SQL; SELECT trim(name) || "=" || "&dataset2" || "_" || name INTO :renamevar separated by " " FROM ( SELECT name FROM dictionary.columns WHERE libname= "WORK" and memname= "&dataset2" and upcase(name) in ( SELECT upcase(name) FROM dictionary.columns WHERE libname= "WORK" and memname= "&dataset1" and upcase(name) ne "PLOT" ) ); QUIT %PUT &renamevar; DATA Land; MERGE LeafL LeafW(rename=(&renamevar)); BY plot; RUN; %MEND; %RENAME (dataset1= LeafL, dataset2= LeafW); RUN; From the log windows (below) seem like there is something wrong with the macro variable but I don't know exactly what happen. WARNING: Apparent symbolic reference RENAMEVAR not resolved. ERROR 180-322: Statement is not valid or it is used out of proper order. NOTE: Line generated by the invoked macro "RENAME". 7 BY plot; -- 180 ERROR 180-322: Statement is not valid or it is used out of proper order. Thanks
... View more