Practical Data Management and Statistical Computing (BioEp691F)

Contacts

Outline
Assignments

Resources


Outline: Lec1 Lec2 Lec3 Lec4 Lec5 Lec6 Lec7 Lec8 Lec9 Lec10
Lectures: Lec1 Lec2 Lec3 Lec4 Lec5 Lec6 Lec7 Lec8 Lec9 Lec10


Lecture 6

1. Review: Problems in Reading Data from ASCII Files (from Assignment #4) Use column input to read the ASCII data set lec3a.dta into SAS (as well as you can). Do not change anything in the ASCII data set. [Note that it is not possible to read all data values in correctly.] (lec3ap1.sas) or (lec3ap2.sas)

Read data in LIST input mode: lec3ap6.sas


2. Once a SAS data set has been created, you can use other PROCedures to describe the data. We illustrate this with data from the Research on the Intensive Care Unit study.

You can copy output to a Word Processor, and use these results in a report.


2. Obtaining Charts with PROC CHART


Introduction

 

We illustrate how to obtain bar charts and histograms illustrating the SAS Procedures:

We use as an example data from the Intensive Care Study (icu.dat). A code book (icu.txt) describes the variables representing the columns, and is neede to interpret the results. We assume that you:


Obtaining Charts and Histograms.

Vertical and horizontal bar charts can be obtained for variables with discrete values, and histograms for continuous variables with PROC CHART. The OPTIONS statement controls the size of the figure that is produced. Other options in the PROC CHART procedure control chart appearance.


Annotated Discussion of Program CHARTP1.SAS


OPTIONS LS=72 PS=55 NODATE NONUMBER NOCENTER;
******************************************************;
*** Program Date Disk Programmer ;
TITLE1 "Source: CHARTP1.SAS 9/24/98 Ed Stanek ";
* DESCRIPTION: ;
* a. Obtaining charts ;
* b. Obtaining historgrams ;
* c. Attaching formats to discete value ;
* using ICU.SD2 created from icu.dat ;
* Examples of PROC CHART, PROC FORMAT ;
******************************************************;
*****************************;
*** Read ICU Study data ***;
*****************************;
DATA icu;

INFILE 'c:\temp\icu.dat' FIRSTOBS=11;
INPUT id sta age sex race ser can crn inf cpr sys hra
pre typ fra po2 ph pco bic cre loc;


PROC FORMAT;

VALUE sexf
0="Male"
1="Female";

VALUE staf

0="Live"
1="Die";

DATA icu1;

SET icu;
FORMAT
sex sexf.
sta staf.;

 


PROC CHART DATA=icu1;

VBAR sex /DISCRETE;
TITLE2 "Figure 1. Frequency Distribution of Gender in Intensive Care Unit Study";


OPTIONS PAGESIZE=30;


PROC CHART DATA=icu1;

VBAR sex /DISCRETE GROUP=sta;
TITLE2 "Figure 2. Frequency Distribution of Gender by Survival Status";
TITLE3 " for subjects in the Intensive Care Unit Study";

 


PROC CHART DATA=icu1;

VBAR sex /
DISCRETE
GROUP=sta
TYPE=PERCENT;

TITLE2 "Figure 3. Percent Frequency Distribution of Gender by Survival Status";
TITLE3 " for subjects in the Intensive Care Unit Study";


PROC CHART DATA=icu1;

VBAR age / SPACE=0;
TITLE2 "Figure 4. Frequency Distribution of Age for Subjects in the ";
TITLE3 " Intensive Care Unit Study";


PROC MEANS DATA=icu1;

VAR age;
TITLE2 "Table 1. Summary Statistics for Age";
TITLE3 " Intensive Care Unit Study";

PROC CHART DATA=icu1;

VBAR age /
MIDPOINTS=10 TO 90 BY 10
SPACE=0;

TITLE2 "Figure 5. Frequency Distribution of Age for Subjects in the ";
TITLE3 " Intensive Care Unit Study";


PROC CHART DATA=icu1;

VBAR age /
MIDPOINTS=10 TO 90 BY 10
SPACE=0
TYPE=PERCENT;

TITLE2 "Figure 6. Percent Relative Frequency Distribution of Age for Subjects in the ";
TITLE3 " Intensive Care Unit Study";

 


PROC CHART DATA=icu1;

VBAR age /
MIDPOINTS=10 TO 90 BY 10
SPACE=0
TYPE=CPERCENT;

TITLE2 "Figure 7. Cumulative Percent Distribution of Age for Subjects in the";
TITLE3 " Intensive Care Unit Study";

RUN;

 

 



Produced and maintained by the Dept of BioEpi at UMASS
Send comments or questions about this web site to Ed Stanek
Email:
stanek@schoolph.umass.edu
\be691f\web\webready\lec6.html
Lst Update: 10/4/99