Exercise1 - AMGN 67.66 100 DELL 24.60 200 GE 34.50 100 HPQ...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
SAS In Class Exercise 1 1. You have a text file called grades.txt containing information on gender (M or F) and four test scores (English, History, Math and Science). Each data value is separated from the others by one or more blanks. Here is a listing of the data file: grades.txt M 80 82 85 88 F 94 92 88 96 M 96 88 89 92 F 95 80 92 92 a. Write a DATA step to read in these values. Choose your own variable names. Be sure that the value for Gender is stored in 1 byte and that the four test scores are numeric. b. Instead of reading in this data set from the file, enter the data yourself by using DATALINES statement. c. Adding labels to the above variables that you defined. d. Include an assignment statement computing the average of the four test scores. e. Write the appropriate PROC PRINT statements to list the contents of this data set. 2. You have a text file called stocks.txt containing a stock symbol, a price a d the number of shares. Here are some sample lines of data: stocks.txt
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: AMGN 67.66 100 DELL 24.60 200 GE 34.50 100 HPQ 32.32 120 IBM 82.25 50 MOT 30.24 100 a. Using this raw data file, create a temporary SAS data set ( Portfolio ). Choose your own variable names for the stock symbol, price, and number of shares. In addition, create a new variable (call it Value) equal to the stock price times the number of shares. Include a comment in your program describing the purpose of the program, your name, and the date the program was written. b. Write the appropriate PROC PRINT statements to list the contents of this data set. c. Delete the variables of price and number of shares. d. Use PROC PRINT statements to list the first 3 observations of this data set. 3. You are given an excel file called political.xls containing state, political party and age. a. Write a SAS program to create a temporary SAS data set called Vote. Use the variable names State, Party, and Age. b. Include a procedure to list the last two observations in this data set....
View Full Document

Ask a homework question - tutors are online