Proc metalib from dynamic tables

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Proc metalib from dynamic tables

Hi,

 

I would like to update metadata of some specific tables from a library.

For example : 

proc metalib;
omr (library="MyLibrary " );
select( just the tables starting with DIM

);
update_rule=(delete);
report;
run;

 

---------------------------------------------------------------

What I did so far : 

 

libname MyLibrary meta library='MyLibrary';
proc sql ;

select memname as dim
into :dim1-:dim19
from sashelp.vmember where libname = "MyLibrary" and memname like "dim%";
quit;

 

%macro dim_lib();

%do i=1 %to 19;
%PUT &&dim&i;
%end;

%mend dim_lib;


proc metalib;
omr (library="MyLibrary");
update_rule=(delete);
select ( %dim_lib ) ;
report;
run;

 

And it seems like proc metalib doesn't see the macro.

Please help.


Accepted Solutions
Solution
‎02-16-2016 03:45 AM
Esteemed Advisor
Posts: 5,198

Re: Proc metalib from dynamic tables

Use the optins mlogic and mprint helps you understand what is going on.

Yo are using an macro call as you would expect to be a macro variable.

The macro use %put which just puts information to the log.

The macro should just return the values you need in the PROC, so skipping %put might help.

Not sure what you use &&dim for, is there some previous step that you don't share?

You could probably simplify this by creating a global macro variable, which you use in the PROC METALIB. Probably easier to trouble shoot.

Data never sleeps

View solution in original post


All Replies
Solution
‎02-16-2016 03:45 AM
Esteemed Advisor
Posts: 5,198

Re: Proc metalib from dynamic tables

Use the optins mlogic and mprint helps you understand what is going on.

Yo are using an macro call as you would expect to be a macro variable.

The macro use %put which just puts information to the log.

The macro should just return the values you need in the PROC, so skipping %put might help.

Not sure what you use &&dim for, is there some previous step that you don't share?

You could probably simplify this by creating a global macro variable, which you use in the PROC METALIB. Probably easier to trouble shoot.

Data never sleeps
Occasional Contributor
Posts: 7

Re: Proc metalib from dynamic tables

Yeey, thank you for suggestions. It helped me find the solution.

The program that works is listed below:

 

_______________________________________________

libname MyLibname meta library='MyLibname';

proc sql ;
select memname as dim
into :dim separated by ' '
from sashelp.vmember where libname = "MyLibname" and memname like "dim%";
quit;

 

proc metalib;
omr (library="MyLibname");
update_rule=(delete);
select ( &dim ) ;
report;
/* noexec; */
run;

 

☑ This topic is SOLVED.

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

Discussion stats
  • 2 replies
  • 326 views
  • 1 like
  • 2 in conversation