Note Old-style macro name not found

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Note Old-style macro name not found

I'm trying to imply a set of code into all datasets in a library (called DATA) through following code:

%macro delete(sourcelib=,source=); 
proc sql noprint;  /*read datasets in a library*/
  create table mytables as
  select *
  from dictionary.tables
  where libname = &sourcelib
  order by memname ;

  select count(memname) 
  into:numb 
  from mytables;

  %let numb=&numb.;  /*give a number to datasets in the library*/

  select memname
  into :memname1-:memname&numb.
  from mytables;
quit;
  
  data 
  %do i=1 %to &numb.;
  &source.&&memname&i
  %end;
  ;
  set
%do i=1 %to %numb.; &source.&&memname&i %end; ; drop price volume bid_imp__vol Ask_Imp__Vol; run; %mend; %delete(sourcelib='DATA',source=DATA.);

However, I received error:

NOTE: Old-style macro name (                  not found.
NOTE: Old-style macro name SOURCELI not found.
NOTE: Old-style macro name =                not found.
NOTE: Old-style macro name 'DATA'        not found.
NOTE: Old-style macro name ,                 not found.
NOTE: Old-style macro name SOURCE   not found.
NOTE: Old-style macro name =                not found.
NOTE: Old-style macro name DATA.        not found.
NOTE: Old-style macro name )                 not found.

 

This is my first time to see such notes. How could I solve them?

 

 


Accepted Solutions
Solution
‎10-26-2016 05:25 AM
Super User
Super User
Posts: 7,668

Re: Note Old-style macro name not found

So, for each dataset in library XYZ you want to drop variables A B C:

data _null_;
  set sashelp.vtable (where=(libname="ABC"));
  call execute('proc datasets lib=abc; modify '||strip(memname)||'; drop a b c; run; quit;');
run;

View solution in original post


All Replies
Super User
Posts: 5,352

Re: Note Old-style macro name not found

[ Edited ]

It's probably a good thing there are errors.  If you got the code to run, it would replace all your data sets with more than you were hoping to get.  Your code would look something like this:

 

data DATA.memname1 DATA.memname2 DATA.memname3;

set DATA.memname1 DATA.memname2 DATA.memname3;

drop ....;

run;

 

That would not be the right way to replace the data sets, so I hope you are testing this on data that you can replace as needed.

 

Regarding your error, nothing is apparent.  Perhaps DELETE is not a valid name for a macro.  Try using another name instead.

Super User
Posts: 18,993

Re: Note Old-style macro name not found

@Astounding is correct, the name %delete is reserved.

 

You do have other issues with your macro, but this is the cause of the error posted.

 

A list of reserved words is here:

http://support.sas.com/documentation/cdl/en/mcrolref/67912/HTML/default/viewer.htm#p0y43hj7lzhq1gn1r...

Solution
‎10-26-2016 05:25 AM
Super User
Super User
Posts: 7,668

Re: Note Old-style macro name not found

So, for each dataset in library XYZ you want to drop variables A B C:

data _null_;
  set sashelp.vtable (where=(libname="ABC"));
  call execute('proc datasets lib=abc; modify '||strip(memname)||'; drop a b c; run; quit;');
run;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 362 views
  • 3 likes
  • 4 in conversation