Dataset details in a SAS library - sas

Can someone please help. I would like to create a table showing all datasets created by me in a particular library, the sizes and dates of creation/modification.
Thanks

The view sashelp.vtable or the dictionary table dictionary.tables both provide this information in table form, as does proc datasets.

Related

What is the query of SAS

What is this SAS query doing?
Data calss;
Set (existing data);
Run;
If you have any answer please help me. And you can tell the source, from where we can practice of query.
We call this a data step. It is rather a program than a query.
In this
Data WORK.CLASS;
Set SASHELP.CLASS;
Run;
With Data WORK.CLASS;, you say the program should make a table CLASS in your WORK library. Libraries are somewhat simular to Db2 schemas; The WORK library is automatically created when you start a SAS session and deleted when you close it.
With Set SASHELP.CLASS;, you say it should read all rows from the CLASS table in the SASHELP library. The SASHELP library is always there. It contains system tables (comparable to the system tables of Db2) and example data that you can use to excersise.
Run; starts compilation and execution

SAS: How to find the dataset in a library that contains the most cases?

As there are many datasets contained in one library. How can I use SAS code to find out which dataset has the largest number of cases?
Suppose the library name is "SASHELP".
Thank you!
The SQL dictionary.* family of tables gives access to all sorts of metadata. Be careful, some dictionary requests can cause a lot of activity as it collects the information requested.
From Docs:
How to View DICTIONARY Tables
…
DICTIONARY Tables and Performance
When you query a DICTIONARY table, SAS gathers information that is pertinent to that table. Depending on the DICTIONARY table that is being queried, this process can include searching libraries, opening tables, and executing SAS views. Unlike other SAS procedures and the DATA step, PROC SQL can improve this process by optimizing the query before the select process is launched. Therefore, although it is possible to access DICTIONARY table information with SAS procedures or the DATA step by using the SASHELP views, it is often more efficient to use PROC SQL instead.
…
Note: SAS does not maintain DICTIONARY table information between queries. Each query of a DICTIONARY table launches a new discovery process.
Example:
* Use dictionary.tables to get the names of the tables with the 10 most rowcount;
proc sql;
reset outobs=10;
create table top_10_datasets_by_rowcount as
select libname, memname, nobs
from dictionary.tables
where libname = 'SASHELP'
and memtype = 'DATA'
order by nobs descending
;
reset outobs=max;

Get server info for all librefs

How can I get a table with variables libref and server_id (or any server info) for all libraries available to me in SAS?
My goal is to get a summary of where the data is physically located for all these libraries, in order to write efficient queries when fetching data from different servers.
Look at what information is available in the view SASHELP.VLIBNAM (or DICTIONARY.LIBNAMES when using PROC SQL).
Here is a utility macro that pulls the engine, host and schema from that view for a given libref. I have used it for TERADATA, ORACLE and ODBC engines. dblibchk.sas
From Tom's code and advices I built the table I needed with this code:
PROC SQL;
SELECT distinct libname, engine, path,
CASE WHEN engine in('BASE','V9') THEN 'SAS' ELSE catx('_',engine,path) END AS server
FROM DICTIONARY.LIBNAMES ;
QUIT;
there are a few tables that can help you in the Library SASHELP like Tom mentioned.
You can also use VTABLE will have all the tables from which library and VCOLUMN will have the detail from library to table to columns as well as the data type used and it's length.
They work a bit like in SQL data from the information_schema database.
Alternatively using proc content on a dataset will also return all of it's component and you can put that in a table or a macro variable.
Hope this helps!

SAS 9.3 Table Properties (Description)

I've been looking for a way to value/change a table's description through a program/code instead of the UI. The table description is on the General tab of the table properties. Everything I've found shows how to through UI but nothing through code. Is this possible?
That's actually the dataset label. That can be added a few ways, basically anywhere you write the dataset, or PROC DATASETS.
proc datasets lib=work;
modify want(label="Want Label");
quit;
Or
data class(label="Class Dataset");
set sashelp.class;
run;

proc contents out size sas

I am trying to create a meta data table for all the tables in the "xyzfolder" using the proc contents function (see below for more details). When the table "all" is created, I noticed that the "file size" column is missing. As in for table ABC in xyzfolder, I would like to look at a column "file size" to see if table ABC is greater than 1 GB.
proc contents data=xyzfolder._all_ out =work.all;
run;
Best way to do this is to use the dictionary tables. You can do that in SQL like so, or in regular SAS using sashelp.vtable.
proc sql;
create table all as
select * from dictionary.tables
where libname='SASHELP';
quit;
If filesize is known to SAS it will be listed here in the column filesize. If it's not known to SAS, you will need to provide some more information as to your operating system, the location and type of the libname, etc. to get useful responses.