SAS Statements: Handy List You Always Need

The following are popular keywords being used in SAS financial analytics. Given here is a complete statements list for your reference:

>sas format

The SAS format applies to conversion from one currency to another currency.
Example:
amount=1145.32;
put amount dollar10.2;
Here, the numeric amount is converted to a dollar amount. The result is as follows:
$1,145.32

>sas input or infile

Use the INPUT statement to read raw data from an external file or in-stream data. If your data are stored in an external file, you can specify the file in an INFILE statement. The INFILE statement must execute before the INPUT statement that reads the data records.

>sas put:

The PUT statement uses an output buffer and writes output lines to an external location, the SAS log, or your monitor. The OUTPUT statement uses the program data vector and writes observations to a SAS data set.

>sas libname

LIBNAME librefSAS-library‘; An engine specification is usually not necessary. If the situation is ambiguous, SAS uses the setting of the ENGINE= system option to determine the default engine. If all data sets in the library are associated with a single engine, then SAS uses that engine as the default. In either situation, you can override the default by specifying another engine with the ENGINE= system option:

>proc import

The IMPORT procedure reads external data and writes the data to a SAS data set.

PROC IMPORT
DATAFILE=<‘filename’>|DATATABLE=<‘tablename’>
<DBMS>=<data-source-identifier>
<OUT>=<libref.SAS data-set-name> <SAS data-set-option(s)>
<REPLACE>;

>proc export sas

It exports data from the SAS dataset to an external file
PROC EXPORT
DATA=<libref.>SAS data-set <(SAS data-set-options)>
OUTFILE=”filename” | OUTTABLE=”tablename
<DBMS=identifier> <LABEL><REPLACE>;

>>sas proc format

The FORMAT procedure enables you to define your own informats and variable formats. In addition, you can print the parts of a catalog that contain informats or formats, store descriptions of informats or formats in a SAS data set, and use a SAS data set to create informats or formats.

>proc summary

specifies whether PROC SUMMARY displays the descriptive statistics. By default, PROC SUMMARY produces no display output, but PROC MEANS does produce display output.

>sas datalines

The DATALINES statement is the last statement in the DATA step and immediately precedes the first data line. Use a null statement (a single semicolon) to indicate the end of the input data.

You can use only one DATALINES statement in a DATA step. Use separate DATA steps to enter multiple sets of data.

>>sas data step

Recall that SAS programs consist of two main blocks of code: the data step and the procedure (proc) step. The data step is where data is created, imported, modified, merged, or calculated.

References

Also, read

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.