Practice

828 Words Jul 26th, 2015 4 Pages
Creating Data Sets 1. You have a text file called scores.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. 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. Include an assignment statement computing the average of the four test scores. c. Write the appropriate PROC PRINT statements to list the contents of this data set. 2. You are given a CSV file called political.csv containing state, political party, and age. a. Write a SAS program to create a temporary SAS …show more content…
Create a temporary SAS data set called Bank using this data file. Use column input to specify the location of each value. Include in this data set a variable called Interest computed by multiplying Balance by Rate. g. List the contents of this data set using PROC PRINT. 7. You have a text file called geocaching.txt with data values arranged as follows: h. Create a temporary SAS data set called Cache using this data file. Use column input to read the data values. i. List the contents of this data set using PROC PRINT. 8. Repeat Problem 6 using formatted input to read the data values instead of column input. 9. Repeat Problem 7 using formatted input to read the data values instead of column input. 10. You are given a text file called stockprices.txt containing information on the purchase and sale of stocks. The data layout is as follows: j. Create a SAS data set (call it Stocks) by reading the data from this file. Use formatted input. Compute the following new variables as you are loading the data: k. Print out the contents of this data set using PROC PRINT 11. You have a CSV file called employee.csv. This file contains the following information: l. Use list input to read data from this file. You will need an informat to read most of these values correctly: i. Separate INFORMAT statement ii. Colon modifier directly in the INPUT statement.

More about Practice