0% found this document useful (0 votes)
102 views15 pages

SAS Print and Data Options Guide

The document outlines various printing and data manipulation options in SAS, including how to manage output formatting, sorting, and importing data. Key features discussed include the use of options like 'noobs', 'width', 'heading', and 'double', as well as procedures for sorting and transposing datasets. It also covers the use of arrays and specific statements for handling unique records and data accessibility.

Uploaded by

akhilesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views15 pages

SAS Print and Data Options Guide

The document outlines various printing and data manipulation options in SAS, including how to manage output formatting, sorting, and importing data. Key features discussed include the use of options like 'noobs', 'width', 'heading', and 'double', as well as procedures for sorting and transposing datasets. It also covers the use of arrays and specific statements for handling unique records and data accessibility.

Uploaded by

akhilesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Print Procedure Options:

Noobs option:

Output:

We are not printing the Obs column ,by default it is appearing.

To remove that Obs column we use option noobs;

Width option:
If we want to increase the width between colunms we use width option.

We have FULL and uniform as values.

Heading option:

Prints the headings in vertical format.

Double Option:

Used to Increase the width between rows.


ID Statement:

If we want print in your particular order.

In previous dataset we have pid as ID column but now we have bank as ID column.

Sum Statement:

If we want to calculate summation of any numeric variables.


Label:

When we use Label statement we must use it as oprtion also.

Split Option:

If we want to split the variable names then we use split option.

Whenever you use by statement you need to sort the data.

If by is used in print proc It behaves like grouping.


If you use ID statement Bank variable comes first in Dataset.

Pageby option:

If we want results in different pages then use pageby option.

Sumby option: applicable numeric variables.


Without pageby option

Proc Sort Procedure:

Sorting by desending order

Bank in desending and year in asending order.

Nodupkey:
Remove the duplicates from the dataset.

In the below example by vatiable bank duplicates are removed.

In the below code it will remove duplicates from bank and area in combined.

Nodurec:

Removes duplicate record

Proc sort will consider ASCII values and sort the data.
Dataset Options:

Where as option

Firstobs:

From 10 th observation it will print the data.

Obs option:

1 to 10th observation.

Upcoming option are more efficient to use at Data step not at set statement.

Replace option:

To avoid missing of data.

Prevents accidental replacing of data.

Password option:

Need password to open the dataset.

To change the password:


Read option:

Those who knows read value can only read the data. Read-only access given to data.

Label option:

labelling the dataset name

labelling the columns

point option:

we can retrive our own defined records in any order.

Record order given in variable

Use loop for iteration

Stops the reding of data

EOF option:

_null_ is for with our creating Dataset we need do


processing

Printing no of records and name and age

Retain option:
First. and last.
If first. and last. Have value 1 then it is unique record.

Importing Data in SAS:

If there is no header in Dataset we use


getnames=no
If I need to subset of data we need to give range:

Sheet name$range in excel

Specifiy the delimeter for csv files


Importing data from Database

Export the Data from SAS.

Proc Transpose:

Long dataset

Wide Dataset

ID statement - which variable data values in the input are converting as variable names in output.

Frm above example - year variable (Income96,97,98)

Var statement : which variable is changing the shape(transpose) give variable in the statement.
Ex: Income variable chahging its shap fromlong to [Link] will create _Name_ automatic variable.

By Statement: based on what reference variable we are transposing the [Link] to sort before
performing transpose operation.

Wide datset to Long dataset:

We are not converting the variable datavalues into column names so no need of id statement.

Income variable is being transposed , so we need to include it in var statement.

Syntax:

Array arrayName (size) variables;

Array Programming:

Group of variables

You can use as


Array test(6) Temp1-Temp6;

Array test(6) _numeric_; array for numeric variables. _character_ for char variables.

If all variables are same type use _all_.

If we don’t know the array size we can write it as dim(test).

Use of _temporary_:

Celsius to farheat program:

2-d array:
Using 2d array

You might also like