SAS Tutorials Tutorial Home

 

SAS Tutorials
Tutorial Home


Read and Wr
ite SAS Data Sets
The Easy, Easy Way
in Windows

See www.stattutorials.com/SASDATA for files mentioned in this tutorial
© TexaSoft, 2007

These SAS statistics tutorials briefly explain the use and interpretation of standard statistical analysis techniques for Medical, Pharmaceutical, Clinical Trials, Marketing or Scientific Research. The examples include how-to instructions for SAS Software.

Reading and creating permanent SAS data sets in Windows

 

There are several ways to read and write permanent SAS data sets. This tutorial presents a handy way to do this in the Windows environment.

 

Creating a Permanent a SAS Data Set in Windows

The technique for creating a permanent SAS data set in Windows is straightforward. Instead of using a temporary SAS data set name such as PEOPLE (or a permanent data file such as MYLIB.PEOPLE) in the SAS DATA statement, use a complete Windows filename.

 

Consider this SAS code:

 

DATA “C:\SASDATA\PEOPLE”;

INPUT ID $ 1 SBP 2-4 DBP 5-7 GENDER $ 8 AGE 9-10 WT 11-13;

DATALINES;

1120 80M15115

2130 70F25180

3140100M89170

4120 80F30150

5125 80F20110

;

RUN;

PROC MEANS;

RUN;

 

This code creates a data set called PEOPLE on your hard drive in the C:\SASDATA folder, and the Window file name of this permanent file is PEOPLE.SAS7BDAT or more precisely,

 

C:\SASDATA\PEOPLE.SASB7DAT

 

That is, instead of using a SAS data set name directly, you can use a Windows filename. Thus,

  • The statement ‘DATA “C:\SASDATA\PEOPLE”;’ creates a permanent SAS data set stored on your hard drive.

Reading from a permanent data set in Windows

 

If you already have a SAS data set on your hard drive -- (named for example PEOPLE.SASB7DAT) anywhere on your system (could be local, network, flash drive, etc) you can access that data set in a SAS procedure using the following technique illustrated here:

           PROC MEANS DATA=”C:\SASDATA\PEOPLE”;RUN;

Where C:\SASDATA\SOMEDATA is the Windows filename for that data set.

 

Run this program and observe that SAS used the data from the file PEOPLE.SASB7DAT to calculate descriptive statistics on the numeric variables from that data set.

NOTE: This method of writing and reading SAS data sets only works in the Windows environment.

End of tutorial

See http://www.stattutorials.com/SAS

 

| Send comments | Tutorial Index | WINKS Software | BeSmartNotes |

 

New
Quick Reference Guide for SAS
BeSmartNotes (tm)

Click for more info
 or to Order

 

For quick and simple statistical analysis use WINKS SDA


Click for more info

Get the SAS BeSmartNotes Quick Reference Guide

Order


| Send comments | Back to Tutorial Menu | TexaSoft |

© Copyright TexaSoft, 1996-2007

This site is not affiliated with SAS(r) or SAS Institute