Input Statement (Column)

Contents Index


Column input is often used when the raw data has been coded in order to be stored in compact form. SAS is told explicitly in which column the data for each variable begins and ends, so that the proper data is read into each variable. This done by positioning a pointer indicating the column(s) from which the next data value is to be read. Here is part of a data set for illustration.

1   333424
2   443324
3   543314

Here the first number in each row is the person number and the group of 6 numbers is the rating (on a scale of 1-5) by that person of 6 products. The ratings of the six products are to be analyzed separately. Here's one input statement.

input person @5 r1 1. r2 1. r3 1. r4 1. r5 1. r6 1.;

The @5 positions the pointer in column 5. Each variable r1-r6 is then read from each sucessive column by specifying the informat 1. (period required) as the width of the data. String variables can be handled similarly. The column pointer moves only by the amount specified by the informat.

The previous input statement can be shortened to

input person @5 (r1-r5) (1.);

This makes use of a shorthand form of column input and also subscripted variables.

Multiple @ statements can be used in a single input statement.

Placing the @ or @@ at the END of an input statement holds the column pointer in position for the correct processing of data cards in which multiple or incomplete records appear on each card.

Further details on using column input can be found in the SAS Language Reference.


Contents Index

Copyright © 1997 by Jerry Alan Veeh. All rights reserved.