CSULB_STAT475_handout1

CSULB_STAT475_handout1 - STAT 475 Chapter 5 GETTING DATA...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT 475 Chapter 5 GETTING DATA INTO SAS There are several ways to input data into SAS: (1) Entering data directly into SAS code (called reading instream data ). (2) Creating dataset inside SAS code using the DO statement. (3) Referencing a SAS data file stored on external drive. (4) Importing a spread sheet file into SAS library. Example 1 (Entering data directly into SAS code). Suppose we are given the following data ID Age ActLevel Sex 2810 61 MOD F 2804 38 HIGH F 2807 42 LOW M 2816 26 HIGH M 2833 32 MOD F 2823 29 HIGH M To enter the data into SAS, type data exercise1; input ID $ Age ActLevel $ Sex $; cards; 2810 61 MOD F 2804 38 HIGH F 2807 42 LOW M 2816 26 HIGH M 2833 32 MOD F 2823 29 HIGH M ; proc print data=exercise1; run; 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Example 2 (Creating dataset inside SAS code using the DO statement). Suppose we are given the following data Sex HIGH MOD LOW M 6 3 1 F 5 4 3 ActLevel To enter the data into SAS, type data exercise2; do counter= 1 to 6 ; actlevel='HIGH'; sex='M'; output; end;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

CSULB_STAT475_handout1 - STAT 475 Chapter 5 GETTING DATA...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online