- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-05-2013 08:32 AM
(13957 views)
Hi Experts,
Could you please tell me the proc sql query in SAS that will output the size of a table(in MB or GB) in SAS ?
6 REPLIES 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
By querying the SAS dictionary, you could get a approximate figure.
If the table is compressed, or has index, it's getting a bit more complex.
If you have tables in BASE engine you could read the OS information, pipe it back to (but this wouldn't be SQL).
Data never sleeps
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, forget sample code:
proc sql;
create table tab as
select libname, memname, nobs, obslen, nobs*obslen as Bytes
from dictionary.tables
where libname='YOURLIB';
quit;
Data never sleeps
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to know how to calculate the file size if the table has index. Could you help me, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
proc sql ;
select libname,memname,filesize,pcompress
from dictionary.tables
;
quit;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's not a SQL query but it is a macro function - https://core.sasjs.io/mf__getfilesize_8sas.html
Usage: %put %mf_getfilesize(libds=work.yourdataset,format=yes);
Usage: %put %mf_getfilesize(libds=work.yourdataset,format=yes);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Does it have to be in PROC SQL? PROC CONTENTS will give you that information as well.