May problem is that I need to change the variable names in an excel sheet so that all the names have _W1 on them. I found a macro that can do this put I'm unsure of how to use it. I used proc contents to pull the names and symput to make then into a macro variable but I cant seem to get it to change the names in data Q. I know Im missing a step. Thanks for the help.
PROC IMPORT OUT= WORK.Q
DATAFILE= "C:\Documents and Settings\boraste\My Documents\SB
_LS_111407.xls"
DBMS=EXCEL REPLACE;
SHEET="SB_Q2";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc contents data = Q out=Qcon noprint;
data Qcon1;
set Qcon (keep = Label);
OPTIONS MPRINT;
data _null_;
set Qcon1;
call symput("vlabel",Label);
%macro rename;
%local varlist i var;
%let name= &vlabel;
%let i=0;
%do %while(%scan(&varlist,&i+1,%str( )) ne %str( ));
%let i = %eval(&i+1);
%let var = %scan(&varlist,&i,%str( ));
&var = W1&var
%end;
%mend rename;
%rename
run;
proc print data = Q;
PROC IMPORT OUT= WORK.Q
DATAFILE= "C:\Documents and Settings\boraste\My Documents\SB
_LS_111407.xls"
DBMS=EXCEL REPLACE;
SHEET="SB_Q2";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc contents data = Q out=Qcon noprint;
data Qcon1;
set Qcon (keep = Label);
OPTIONS MPRINT;
data _null_;
set Qcon1;
call symput("vlabel",Label);
%macro rename;
%local varlist i var;
%let name= &vlabel;
%let i=0;
%do %while(%scan(&varlist,&i+1,%str( )) ne %str( ));
%let i = %eval(&i+1);
%let var = %scan(&varlist,&i,%str( ));
&var = W1&var
%end;
%mend rename;
%rename
run;
proc print data = Q;