Question: Use SAS PROGRAM TO SOLVE The Problem 1. (a) Each subject in a study has two lines of data. Line 1 contains an ID, GENDER

Use SAS PROGRAM TO SOLVE The Problem

1. (a) Each subject in a study has two lines of data. Line 1 contains an ID, GENDER( M or F), and DOB; line 2 contains HEIGHT and WEIGHT. All data values are separated by commas.

Write a SAS DATA step using List input to read the following sample lines of data into a data set named Q1_A:

001,M,06/14/1944

68,155

002,F,12/25/1967

52,99

003,M,07/04/1983

72,128

004,M,08/05/1982

70,115

005,F,09/13/1975

56,113

(b) Each data line below contains ID in columns 1-3, DOB (in MMDDYY form) in columns 4-11, SEX(M or F) in column 12, HEIGHT in columns 13-14, WEIGHT in columns 15-17. Create a SAS data set named Q1_B consisting of data for female only. Do this by first testing the value of SEX and only reading the remaining values if the line contains female data.

01204/04/77M69110

01103/06/80F55 99

01002/08/74F58120

00906/05/86M76160

00803/03/79F51 95

(c) Merge the data sets Q1_A and Q1_B to the data set Q1_ALL. (Hint: the variable names of male and female variable in two data sets are different.)

(d) Using Q1_ALL, create a new data set named Q1_FINAL containing two more variables AGE and GROUP (Old or Young). Calculate the ages of five subjects by 03/01/2011. Depending on the AGE, determine the value of GROUP: if AGE>60, then the value of GROUP is Old; if AGE<=60, then the value of GROUP is Young. Remove the variable DOB. Attach the SAS codes and the proc print output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!