please help in sas 5 .47 .62 9 10 125.7 5 .57 .67 10 10 135.6 5 .50 .65 7 10 106
ID: 3201458 • Letter: P
Question
please help in sas
5 .47 .62 9 10 125.7
5 .57 .67 10 10 135.6
5 .50 .65 7 10 106.8
. .50 .62 8 10 106.4
5 .52 .64 7 10 114.8
5 .48 .66 7 10 118.0
5 .54 .67 6 10 135.1
5 .63 .65 7 8 125.6
4 .60 .69 7 8 131.3
4 .53 .74 10 9 121.3
5 .71 .55 6 8 89.4
5 .58 .60 6 10 94.5
4 .55 .56 7 9 90.4
3 .47 .66 10 8 150.8
3 .43 . 9 8 155.8
5 .65 .63 7 8 112.6
5 .67 .67 6 8 107.1
3 .52 .59 5 7 73.9
3 .44 .57 5 7 78.8
5 .64 .60 5 7 131.0
5 .62 .61 4 7 128.1
5 .70 .59 7 7 105.7
5 .72 .54 7 6 106.6
6 .67 .53 7 6 150.9
6 .64 .56 7 7 135.6
5 .94 .48 6 6 88.9
5 .84 .48 5 5 85.5
5 .68 .46 6 5 81.5
2 .75 .48 4 3 99.3
2 .65 .49 4 4 96.9
After, you've successfully read in the data, create four new variables in your bonescore1 data set: flag1, flag2, flag3, and flag4 according to the following specifications:
So, for example, flag1 should be assigned the value 1 if singh is less than or equal to 4, flag1 should be assigned the value 2 if singh is greater than 4, but less than or equal to 5, and flag1 should be assigned the value 3 if singh is greater than 5.
In writing the necessary if-then-else statements to create the four new variables intentionally fail to program for missing values. That is, for example, your if-then-else statement for the creation of flag1 should contain just three lines — one if condition, and two else-if conditions. Similarly, the if-then-else statements for the creation of flag2, flag3, and flag4 should each contain three lines. After you've created the four flag variables, create a fifth new variable called ourscore, which is merely the sum of the four flag variables. Print the bonescore1 data set, and observe that one of the values for flag1 and one of the values for flag3 have been improperly assigned. Why? Also note that the errors in flag1 and flag3 also cause errors in the ourscore variable. Why?
Value of flag variable Flag variable 1 2 3 flag1 singh 4 4 < singh 5 singh > 5 flag2 ccratio > 0.67 0.52 < ccratio 0.67 ccratio 0.52 flag3 csi 0.55 0.55 < csi 0.65 csi > 0.65 flag4 calcar 6 6 < calcar 7 calcar > 7Explanation / Answer
We cannot provide solutions using the paid softwares such as sas , however we can provide solutions using the freewares such as the R statistical package . Also the data set given doesnt have any header information , so i am going to simulate the data in R and show how to create flag variable for such data , the concepts would remain the same irrespective of the tool we use
# simulate some random data
singh <- round(runif(100,1,5),0)
ccratio <- runif(100,0.4,0.7)
csi <- runif(100,0.1,1)
calcar <- round(runif(100,1,10),0)
df<- as.data.frame(cbind(singh,ccratio,csi,calcar))
# create the flags using the ifelse statement in R
df$flag1 <- ifelse(df$singh<=4 & ccratio>0.67 & csi <=0.55 & calcar<=6,1,0)
# create the flags using the ifelse statement in R
df$flag2 <- ifelse(df$singh<5 & df$singh>4 & ccratio>0.52 & ccratio<=0.67& csi >0.55 & csi <=0.65 & calcar> 6 & calcar<=7,1,0)
# create the flags using the ifelse statement in R
df$flag3 <- ifelse(df$singh>5 & ccratio<=0.52 & csi>0.65 & calcar> 7,1,0)
# print the results
print(df)
Please note that this is a random data , hence the results will not be exactly the same . The working remain the same though
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.