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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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