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.
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.
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.
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.
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.