BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ak2
Calcite | Level 5 ak2
Calcite | Level 5

Hi! I want to store a table into a library using proc metalib and the select statement, but my table is not added to the library called myLib. I also need the table to have a macro (&myDate.) as a table name. Can anyone help me with this? This is my code:

 

data myLib.&myDate;

set x;

run;

 

proc metalib;

omr(library="myLib" repname="something");

select (myLib.&myDate);

update_rule=(delete);

run;

 

And the log output:

NOTE: Metadata for 0 tables was updated.

NOTE: Metadata for 0 tables was deleted.

NOTE: Metadata for 0 tables was added.

NOTE: Metadata for 0 tables matched the data sources.

NOTE: 1 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.

NOTE: 0 other tables were not processed due to error or UPDATE_RULE.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I don't know this procedure, however I would give you some points:

Why specify library - mLib - in both the cmr() and the select(), surely it should only appear in the cmr.  And according to the documentation:

http://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003181502.htm

It should look like: select("&MyDate.");

You will see this note states the select wasn't found: 

NOTE: 1 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.

 

Also note, that macro variables can have spaces at the end to make the length up, so you might need %trim() in there as well, but try the above.  Now, this assumes that in the library mlib, you have a dataset which is the same text as mydate.  However what I would say is that dates - unless you start with a character - are not valid SAS names, so maybe that is your problem, you haven't showed what &Mydate actually resolves to.  

 

As another tip, don't put "data" items in names, its never a good idea.  By "data", I mean things like dates, which should be in datasets (as in the name "data"sets) - names are for programming purposes so make them simple and generic.

 

 

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, I don't know this procedure, however I would give you some points:

Why specify library - mLib - in both the cmr() and the select(), surely it should only appear in the cmr.  And according to the documentation:

http://support.sas.com/documentation/cdl/en/lrmeta/60739/HTML/default/viewer.htm#a003181502.htm

It should look like: select("&MyDate.");

You will see this note states the select wasn't found: 

NOTE: 1 tables listed in the SELECT or EXCLUDE statement were not found in either the metadata or the data source.

 

Also note, that macro variables can have spaces at the end to make the length up, so you might need %trim() in there as well, but try the above.  Now, this assumes that in the library mlib, you have a dataset which is the same text as mydate.  However what I would say is that dates - unless you start with a character - are not valid SAS names, so maybe that is your problem, you haven't showed what &Mydate actually resolves to.  

 

As another tip, don't put "data" items in names, its never a good idea.  By "data", I mean things like dates, which should be in datasets (as in the name "data"sets) - names are for programming purposes so make them simple and generic.

 

 

ak2
Calcite | Level 5 ak2
Calcite | Level 5
I changed select (myLib.&myDate) to select ("&myDate") and it seems to be working as expected. Thank you so much for your help!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2247 views
  • 0 likes
  • 2 in conversation