BookmarkSubscribeRSS Feed
kyle234
Calcite | Level 5

I have a library and I want just the tables and not the views in the library. Thank you!

10 REPLIES 10
maguiremq
SAS Super FREQ

I've never done it, but documentation from PROC DATASETS appears you can set MEMTYPE to view. I don't have time to test it either, so someone else may know better.

 

Next question would be what you want to do with it. Delete? Move?

kyle234
Calcite | Level 5

I would like dbms_memtype not the memtype data. I would just like the library changed to just include those tables. Thank you!

Quentin
Super User

A SAS libref points to a location that stores stuff (tables, views, catalogs, etc.)  That location could be a folder on Windows, a directory on linux, a database schema, or many other types of locations.

 

So if your libref is pointing to, say, a  directory, and you have both tables and views in that directory, then the library will have tables and views in it.  If you don't want views to be in the library, you would need to move them from that location.

 

That said, your goal isn't really clear to me.  It might help if you describe your current situation.  What OS are you using? Where are the tables and views stored? How did you create the libref that points to the library (can you show the LIBNAME statement)? Why don't you want the views to be in the library?

BASUG is hosting free webinars Next up: Mark Keintz presenting History Carried Forward, Future Carried Back: Mixing Time Series of Differing Frequencies on May 8. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
Tom
Super User Tom
Super User

@kyle234 wrote:

I would like dbms_memtype not the memtype data. I would just like the library changed to just include those tables. Thank you!


What is the DBMS?  You might try adding the DB_OBJECTS=TABLES option to your LIBNAME statement that defines the "library".

 

DB_OBJECTS=TABLES | VIEWS | SYNONYMS | PUBLIC_SYNONYMS | ALL
Specifies which database objects to return with PROC DATASETS or in SAS Explorer.
Product: SAS/ACCESS for Relational Databases
Document: SAS/ACCESS for Relational Databases: Reference
kyle234
Calcite | Level 5

I have a library that I want to subset to only include tables that are dbms_memtype='table'. Thank you!

Ksharp
Super User
proc copy in=in out=out memtype=data;
run;

could only copy sas datasets from IN libname to OUT libname.
Tom
Super User Tom
Super User

@kyle234 wrote:

I have a library and I want just the tables and not the views in the library. Thank you!


What do you mean by "want"?

 

Do you want to make a list of the table names? 

Do you want to delete the views?

Do you want the views to somehow disappear from the GUI list of tables but not actually be deleted?  Why?  What GUI tool are you using? SAS/Studio? Something else?

 

Is the libref pointing at actual SAS datasets and SAS views?  You can check DICTIONARY.MEMBERS to tell what type of file each member in the library is.

 

Or is the libref pointing at an external database like Oracle?  If the later then how you can tell if a "table" in the library is actually a view would probably depend on what database you are using.

kyle234
Calcite | Level 5

There is a library is SAS currently with table want the library to only have view tables. Not sure if that means copy into new library. Thanks

Reeza
Super User
As far as I know you cannot limit a library to just views or tables.

Reeza
Super User
Workaround, create a new library that has only views that points to only tables in the library. Run it every x hours to have it updated (data will not update, only view definitions).

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 10 replies
  • 506 views
  • 5 likes
  • 6 in conversation