Skip Navigation Links

Page One

Campus Computing News

BulkMail To: Address Changed

New CBT Courses in Digital Imaging and Web Development

Save Travel Dollars With Videoconferencing

Coming Next Week to a Convention Center Near You!

The Unintended Consequences of Making Music

Today's Cartoon

RSS Matters

SAS Corner

The Network Connection

Link of the Month

WWW@UNT.EDU

Short Courses

IRC News

Staff Activities

Subscribe to Benchmarks Online
    

Research and Statistical Support

SAS Corner

Multiple Records per Observation

By Garvii Thomas, Research and Statistical Support Services Consultant

A question that was asked of me recently was to show how SAS can deal with an external file that has multiple records per observation.  The person had a huge dataset in which the observation took up more than one line.  I then proceeded to show him how easy it was in SAS with a similar program to the one I'm about to show you.  After making a slight adjustment to the insurance dataset and calling it Insurance2.dat each patients' information now takes up two lines as shown below.

SAS program for viewing raw data file

Raw data file

The key to accomplishing this is controlling when each record loads.  This is controlled by having a second input statement to deal with in data that is on the second line for each observation.  This allows each line of the observation to be loaded independently ( a third input statement will be needed if there was a third row of records and so forth).

SAS program with second INPUT statement

Lets now take a look at our output:

final output

Once again an expansion of this and other concepts in SAS will be covered in my SAS short course series ( http://www.unt.edu/rss/ ) for the Spring Semester here at UNT.

Check out this paper on debugging code in SAS: http://support.sas.com/sassamples/papers/debug101_03jan.pdf