BookmarkSubscribeRSS Feed
kyle234
Obsidian | Level 7

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
Obsidian | Level 7

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?

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
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
Obsidian | Level 7

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
Obsidian | Level 7

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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 10 replies
  • 1461 views
  • 5 likes
  • 6 in conversation