How to Determine the Size of a SAS Data Set

How to Determine the Size of a SAS Data Set

How to Determine the Size of a SAS Data Set

When program codes, applications and SAS data sets are developed, enough attention is often not given to EFFECIENCY, especially during the initial phases of development. Since, data size and system conduct can influence a program or an application’s functioning, SAS users need to access information about a data set’s size and content. To ascertain how much disk space a data set is using, users can easily do a few calculations to learn to access metadata content and attain the important information. Determine, estimate and understand information with this following tip, which helps improve SAS performance and fine-tuning of techniques.

Also read: How to Code Colour Values Within SAS Enterprise Guide


Implementing PROC SQL and DICTIONARY.TABLES

The SAS system accumulates valuable information (also known as metadata) about all-familiar SAS libraries, indexes, data sets (tables), system options, views, catalogs, macros and an assemblage of other “read-only” tables called Dictionary tables and SASHELP views. TABLES, a particular Dictionary table and its SASHELP view equivalent, VTABLE, consists details about a SAS session’s data set. Check the following PROC SQL code as its specification will help us get access to the contents of four columns observed in the TABLES Dictionary table, namely BNAME, MEMNAME, MEMTYPE and FILESIZE to exhibit the size of the CARS data set.

Also read: How to Use PUT and %PUT Statements in SAS: 6 Tips


PROC SQL and Dictionary.TABLES:

PROC SQL ;
  TITLE ‘Filesize for CARS Data Set’ ;
  SELECT LIBNAME,
         MEMNAME,
         FILESIZE FORMAT=SIZEKMG.,
         FILESIZE FORMAT=SIZEK.
    FROM DICTIONARY.TABLES
      WHERE LIBNAME = ‘SASHELP’
        AND MEMNAME = ‘CARS’
        AND MEMTYPE = ‘DATA’ ;
QUIT ;

Results

Size-of-SAS-data-set1

Analysis

The above results show that the CARS data set filesize is 192KB.

Nota bene: If the SIZEKMG.format is mentioned in a format=option, SAS ascertains whether it should apply KB for kilobytes, MB for megabytes or GB for gigabytes, and divide the filesize value with the help of one of the following values:

KB           1024

MB          1048576

GB           1073741824


Using PROC PRINT and SASHELP.VTABLE

In the following example, the provisions of a PROC PRINT are explained to access the constituents of three columns found in the VTABLE SASHELP view, particularly LIBNAME, MEMNAME and FILESIZE to exhibit the size of the CARS data set.

Also read: SAS Still Dominates the Market After Decades of its Inception


PROC PRINT and SASHELP.VTABLE

PROC PRINT DATA=SASHELP.VTABLE NOOBS ;
  VAR LIBNAME MEMNAME FILESIZE ;
  WHERE LIBNAME = ‘SASHELP’
    AND MEMNAME = ‘CARS’ ;
  FORMAT FILESIZE SIZEKMG. ;
  TITLE ‘Filesize for SASHELP.CARS Data Set’ ;
RUN ;

Results

Size-of-SAS-data-set2


Using DATA _NULL_, SASHELP.VEXTFL and CALL SYMPUTX

Lastly, a DATA_NULL_ is depicted to approach the contents of the VEXTFL SASHELP view with a FILENAME statement. An assignment statement is specified to determine the FILESIZE value for the size of the CARS data set. The CALL SYMPUTX left supports and chops off the trailing blanks from the digital FILSESIZE value of 196608.

Also read: Things to judge in SAS training centres


DATA_NULL_and SASHELP.VEXTFL

filename myfile 'C:\Program Files\SAS9.4\SASFoundation\9.4\\CORE\SASHELP\Cars.sas7bdat' ;
DATA _NULL_ ;
  SET SASHELP.VEXTFL (WHERE=(FILEREF=’MYFILE’)) ; 
  /* Calculate the Filesize in MB */
  FILESIZE = FILESIZE / (1024 ** 2) ;
  CALL SYMPUTX (‘FILESIZE’,FILESIZE) ;
RUN ;

Results

Size-of-SAS-data-set3

 

Learn more about SAS Predictive Modelling by taking up SAS certification courses in Delhi and Gurgaon. DexLab Analytics offers excellent SAS analytics course for data enthusiasts.

 
This post originally appeared onblogs.sas.com/content/sastraining/2017/04/25/determining-the-size-of-a-sas-data-set
 

Interested in a career in Data Analyst?

To learn more about Machine Learning Using Python and Spark – click here.
To learn more about Data Analyst with Advanced excel course – click here.
To learn more about Data Analyst with SAS Course – click here.
To learn more about Data Analyst with R Course – click here.
To learn more about Big Data Course – click here.

May 3, 2017 9:55 am Published by , , , , , , , , , ,

online certification, online courses, SAS, sas certification, Sas course, SAS Predictive Modelling, SAS training courses, Sas training institute

Call us to know more