DATA Step, Macro, Functions and more

macro resolution

Reply
Super Contributor
Posts: 647

macro resolution

macro wksht resolves to 'Data Template$' (with quotes around it).
when i run the following i get an error:

%macro test;
proc sql;
connect to excel (path="&inpt.\Nationwide Childrens Hospital 2009 08.xls"
header=no mixed=yes );

create table NationwideChildern as
select * from connection to excel
%if %substr(%superQ(wksht),1,1) = %str(%') %then %do;
(select * from [%sysfunc(dequote(%superQ(wksht)))]);
%end;
%else %do;
(select * from [&wksht]);
%end;
disconnect from excel;
quit;
%mend test;
%test;



ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: %substr(%superQ(wksht),1,1) = '
ERROR: The macro TEST will stop executing
Respected Advisor
Posts: 3,777

Re: macro resolution

try %Qsubstr
Super Contributor
Posts: 647

Re: macro resolution

Thanks for the tip!
Ask a Question
Discussion stats
  • 2 replies
  • 117 views
  • 0 likes
  • 2 in conversation