17.11.2014 Views

Download - United States Renal Data System

Download - United States Renal Data System

Download - United States Renal Data System

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

There are two parts to the ‘data=’ expression. The first is the directory location, defined by the LIBNAME, and the second is the<br />

dataset name. The first part (directory location) implies that the dataset is permanent. Later examples do not include this part,<br />

and the datasets you create will disappear when you leave SAS. To permanently save a dataset, the first part of the expression<br />

must be included.<br />

SAS Formats for USRDS data<br />

Information in a dataset may be coded. Thus, the variable GENDER may have the values F, M, or U, where F is the coded value<br />

for female, M is the value for male, and U is the value for unknown. Using one character instead of several saves disk storage,<br />

but because the coded values are not always easy for users to understand, a format is assigned to translate them. Many variables<br />

have been assigned formats by the USRDS.<br />

In each program, SAS must be told where these formats are. Assume that the format catalog is in the directory C:\SAF. Then the<br />

following SAS LIBNAME makes the formats accessible to your SAS programs.<br />

LIBNAME LIBRARY ‘c:\saf’; * Directory location of format catalog;<br />

The SAS keyword LIBRARY must be used because it tells SAS to look for formats in the directory, C:\SAF. Other methods can<br />

accomplishing this, but not as easily. To bypass the use of formats, use the following two SAS statements before running any SAS<br />

procedures:<br />

LIBNAME LIBRARY;<br />

OPTIONS NOFMTERR<br />

Bypassing the use of formats allows you to see raw data instead of the formatted values, which may be useful when you need<br />

to write SAS IF statements to control the flow of your program in a SAS data step. See <strong>Data</strong> Formatting for a tabular list of the<br />

formats with their coded values.<br />

Comment Lines<br />

Comment lines in the SAS code look like this:<br />

/* Comment line */<br />

* Comment line;<br />

These refer to any descriptive comment. The use of comments is optional but strongly recommended.<br />

The SAF Directory<br />

Throughout this section SAF has been used as the permanent SAS LIBNAME. It is assumed that all of the USRDS SAF datasets<br />

and catalogs have been placed in this directory. If the datasets have been placed in the WINDOWS directory C:\SAF, then the<br />

following SAS LIBNAME would point to the SAF datasets.<br />

LIBNAME saf ‘c:\saf’;<br />

Note: The datasets may be loaded into any directory, with the directory in the LIBNAME changed accordingly.<br />

Examples<br />

LIBNAME core_cd ‘C:\USRDS\CORE_CD\SAF’;<br />

LIBNAME hosp_cd ‘C:\USRDS\HOSP_CD\SAF’;<br />

LIBNAME in_cd ‘C:\USRDS\IN\SAF’;<br />

LIBNAME cpm_cd ‘C:\USRDS\CPM\SAF’;<br />

LIBNAME library ‘C:\USRDS\CORE_CD\SAF’;<br />

Example 1: Incident Cohort<br />

Create a patient cohort of incident patients from 1990 to 1999 to use in the examples that follow.<br />

DATA inc90_99 (KEEP=usrds_id esrddate inc_year rxgroup);<br />

SET core_cd.rxhist60;<br />

BY usrds_id begdate;<br />

FORMAT esrddate MMDDYY10.;<br />

IF (FIRST.usrds_id) AND<br />

(MDY(1,1,1990)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!