Home Work 1

Due by 12:00 noon, 1/10/2015 (Sunday)

Note: Please read through the class document. Most of the answer can be found from the class document. For program writing partjust follow the examples in the class document.

Solutions will be posted at due time

  1. SAS statements usually begin with an ______.
  2. Every SAS statement ends with a ______.
  3. Character variable values can be up to ______characters long for v9

and use _____ byte(s) of storage per character.

  1. A SAS variable name has ______to ______characters and begin with a ______or an ______.
  2. Numeric variable is ___ to ___ bytes long. By default, numeric variables are stored in ______bytes of storage.
  3. A missing character value is displayed as a ______.
  4. A missing numeric value is displayed as a ______.
  5. What are the two kinds of steps?
  6. SAS step start with the following key words: ______, and ______.
  7. The end of SAS step is identified by the following key words:

______, ______, ______, and ______.

  1. What are the two types of variables?
  2. What are the two major parts of SAS output?

For the following two questions, if the directory does not exist, create first.

  1. 1) Write a filename statement reference to file:

/courses/ddbf9765ba27fe300/bill.txt

2)Write a filename statement reference to file: c:\sas_class\classdata\NFL_Score.txt

3)Write a libname statement reference to directory: c:\sas_class\classdata

4)Write a libname statement reference to directory:

/courses/ddbf9765ba27fe300

  1. Complete the following program and review the output data. The top part is the original data with position ruler. The line with RED font is the name for each column.The bottom part is the un-completed program.

/* 1 2 3 4 5 6 7 8

12345678901234567890123456789012345678901234567890123456789012345678901234567890 */

Status Sex Height Weight DeathCause

Dead Female 63.75 115 Cerebral Vascular Disease

Dead Male 66 168 Cerebral Vascular Disease

Alive Female 64.5 157 Coronary Heart Disease

Dead Female 63.5 178 Coronary Heart Disease

*********************************************************************;

*** Complete the following SAS Program;

data heart;

datalines;

Dead Female 63.75 115 Cerebral Vascular Disease

Dead Male 66 168 Cerebral Vascular Disease

Alive Female 64.5 157

Dead Female 63.5 178 Cancer

;

run;

proc print data= ______;

run;

  1. Write your own programs to read the following data into sas dataset, then print the sas dataset into the output window to review.
  • /courses/ddbf9765ba27fe300/stock.txt

output: work.stock

  • /courses/ddbf9765ba27fe300/col_input.txt

output: col_input

  • /courses/ddbf9765ba27fe300/fmt_input.txt

output: fmt_input

  1. Use the following data (blue font part)as data for CARDSstatement, then write a SAS program read the data to a SAS dataset. Use the Red font line as variable names. Make the output data name as: work.practice1.

PID BIRTHDD BIRTHMM BIRTHYY BIRTHDT AGE GENDER

10001 4 FEB 1948 04FEB48:00:00:00 47 FEMALE

10002 25 APR 1949 25APR49:00:00:00 46 MALE

10003 4 MAR 1934 04MAR34:00:00:00 61 MALE

10004 8 OCT 1951 08OCT51:00:00:00 44 MALE

10005 27 FEB 1942 27FEB42:00:00:00 53 FEMALE

10006 14 JUL 1952 14JUL52:00:00:00 43 FEMALE

10007 19 SEP 1946 19SEP46:00:00:00 49 FEMALE

10008 28 DEC 1942 28DEC42:00:00:00 53 MALE

10009 6 JUL 1962 06JUL62:00:00:00 33 FEMALE

10010 7 JUL 1948 07JUL48:00:00:00 47 FEMALE

10011 23 JAN 1957 23JAN57:00:00:00 38 FEMALE

10012 8 SEP 1948 08SEP48:00:00:00 47 MALE

10013 12 OCT 1953 12OCT53:00:00:00 42 FEMALE

10014 9 FEB 1941 09FEB41:00:00:00 55 FEMALE

10015 9 JAN 1945 09JAN45:00:00:00 51 FEMALE

10016 10 DEC 1938 10DEC38:00:00:00 57 FEMALE