SAS/Data Management

Library
Data are stored in a directory. You can give a name to that directory using the 'libname' statement.

Read/Describe/list data

 * Proc dataset
 * Proc content
 * Proc print

The Proc datasets allow to list the content of all the datasets in a library

Generate Random Variables
The following program draws 5 observations from a normal distribution with expectancy 1.75 and standard deviation 0.1. The rannor function draws from a standard normal distribution. The argument specifies the seed. This allows reproducibility.

If you know the quantile function (inverse CDF), you can draw in the distribution using the inverse CDF method. You simple have to draw in a uniform distribution and transform the draw using the inverse CDF function. Here is an example with a Gumbel distribution :

Sorting
The default is ascending sort. If you want to put the highest values first, you can use by descending.

Merge
It is better to sort the data before merging them.

Import from other format
You can import from a CSV:

You can also specify the delimiter.

You can import from an xls file.

Export to other format
First one can export to Excel :

Creating aggregate tables
One can create aggregate table using the output delivery system (ODS). The following program creates a table of the cross tabulation and store it in a new dataset.