Question

In: Statistics and Probability

IN SAS: The local school district wants to survey all sixth-grade students and their school aged...

IN SAS:

  1. The local school district wants to survey all sixth-grade students and their school aged siblings. There are three surveys to do: one for the sixth graders, one for their younger siblings, and one for their older siblings. You are to help the district office to administer the survey. The school district has data on the students to facilitate the survey. The SAS data set called SCHOOLSURVEY contains data for all sixth graders in the three middle schools in the district (Rachael Carson, Green Valley, and Redwood Grove), and also data for all their siblings attending schools in the district, which can be linked back to the sixth grader by Family_ID. (Note: sixth grade is in the middle school for most schools in the US).

a. Examine this SAS data set including the variable labels and attributes. Add a comment to your program that notes the sort order of the variables in this data set.

b. Create a data set that has one observation for each sixth grader.

Solutions

Expert Solution

Here, Fam_id = Family_id

Std_id = Student_id

Sch = School Code

DOB = Date of birth for all the grade students

DOB6th = Date of birth of the 6th grade student for a given Family_id

Agg_Diff = Age difference in years between 6th grade student and his/her siblings for a given Family_id

Output should look like this :

 Fam_id Sdt_ID Sch Grade DOB DOB6th Age_Diff Y_sib O_sib 90021 103699 4th 07/24/2004 01/26/2002 2.49 90021 127945 RG 6th 01/26/2002 01/26/2002 0 2 0 90021 149229 2nd 10/28/2005 01/26/2002 3.75 90053 109831 RC 6th 08/27/2002 08/27/2002 0 1 1 90053 122779 5th 08/28/2003 08/27/2002 1 90053 124617 8th 05/07/2000 08/27/2002 -2.31 90097 145616 4th 06/06/2004 12/20/2001 2.46 90097 164264 RC 6th 12/20/2001 12/20/2001 0 1 0 90112 147688 7th 10/11/2000 02/23/2002 -1.37 90112 171989 9th 06/27/1999 02/23/2002 -2.66 90112 197925 RG 6th 02/23/2002 02/23/2002 0 0 2

where, Y_sib = number of younger siblings of the sixth grader

O_sib = number of older siblings of the sixth grader

DATA TEMP;
INPUT Fam_id Sdt_ID Sch $ Grade $ DOB DOB6th Age_Diff;
INFORMAT DOB DOB6th mmddyy8.;
FORMAT DOB DOB6th mmddyy10.;
CARDS;
90021 103699 . 4th 07/24/2004 01/26/2002 2.49
90021 127945 RG 6th 01/26/2002 01/26/2002 0
90021 149229 . 2nd 10/28/2005 01/26/2002 3.75
90053 109831 RC 6th 08/27/2002 08/27/2002 0
90053 122779 . 5th 08/28/2003 08/27/2002 1
90053 124617 . 8th 05/07/2000 08/27/2002 -2.31
90097 145616 . 4th 06/06/2004 12/20/2001 2.46
90097 164264 RC 6th 12/20/2001 12/20/2001 0
90112 147688 . 7th 10/11/2000 02/23/2002 -1.37
90112 171989 . 9th 06/27/1999 02/23/2002 -2.66
90112 197925 RG 6th 02/23/2002 02/23/2002 0
;
RUN;


PROC SQL;
CREATE TABLE TEMP_CAL AS
Select
COALESCE(A.Fam_id,B.Fam_id) as Fam_id, /*SAS Functions are also applicable in PROC SQL queries including normal SQL functions*/

CASE WHEN A.Old_Student_Count=. THEN 0
ELSE A.Old_Student_Count
END as Old_Student_Count,

CASE WHEN B.Young_Student_Count=. THEN 0
ELSE B.Young_Student_Count
END as Young_Student_Count
FROM
(
Select
Fam_id,
Count(Distinct Sdt_ID) as Old_Student_Count
FROM
TEMP
WHERE
Age_Diff<0
GROUP BY Fam_id
) A

FULL JOIN

(
Select
Fam_id,
Count(Distinct Sdt_ID) as Young_Student_Count
FROM
TEMP
WHERE
Age_Diff>0
GROUP BY Fam_id
) B

ON A.Fam_id=B.Fam_id
;
QUIT;


DATA TEMP_FINAL;
IF _n_=1 THEN DO;
IF 0 THEN SET TEMP_CAL;

Declare Hash h1(dataset:'TEMP_CAL');
h1.definekey('Fam_id');
h1.definedata('Young_Student_Count','Old_Student_Count');
h1.definedone();
END;

SET TEMP;

h1.find(key:Fam_id);

IF Grade NE '6th' THEN DO;
Young_Student_Count=.;
Old_Student_Count=.;
END;

RUN;

PROC PRINT DATA=TEMP_FINAL;
TITLE 'Final Table';
RUN;


Related Solutions

In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 2323 scores from all of the students who took the test. She sees that the mean score is 147147 with a standard deviation of 18.963118.9631. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 1212. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 25 scores from all of the students who took the test. She sees that the mean score is 170 with a standard deviation of 4.0774. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 13. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 22 scores from all of the students who took the test. She sees that the mean score is 160 with a standard deviation of 28.2396. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 28. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendent of...
In a school district, all sixth grade students take the same standardized test. The superintendent of the school district takes a random sample of 26 scores from all of the students who took the test. She sees that the mean score is 130 with a standard deviation of 7.2344. The superintendent wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 16. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 26 scores from all of the students who took the test. She sees that the mean score is 101 with a standard deviation of 10.1793. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 21. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 29 scores from all of the students who took the test. She sees that the mean score is 167 with a standard deviation of 11.4238. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 18. Is there evidence that the standard deviation of test scores has...
In a school district, all sixth grade students take the same standardized test. The superintendant of...
In a school district, all sixth grade students take the same standardized test. The superintendant of the school district takes a random sample of 25 scores from all of the students who took the test. She sees that the mean score is 139 with a standard deviation of 16.5865. The superintendant wants to know if the standard deviation has changed this year. Previously, the population standard deviation was 29. Is there evidence that the standard deviation of test scores has...
The following table shows the number of fifth and sixth grade teachers in a school district...
The following table shows the number of fifth and sixth grade teachers in a school district and the number of students in each of those grades. The number of teachers for each of the grade levels was determined by using the Huntington-Hill apportionment method. The district has decided to hire a new teacher for either the fifth or sixth grade. Number of teachers Number of students Fifth grade 19 607 Sixth grade 23 739 (a) Use the apportionment principle to...
Suppose in a local Kindergarten through 12th grade (K - 12) school district, 53 percent of...
Suppose in a local Kindergarten through 12th grade (K - 12) school district, 53 percent of the population favor a charter school for grades K through five. A simple random sample of 800 is surveyed. Calculate the following using the normal approximation to the binomial distribution. (Round your answers to four decimal places.) (a) Find the probability that less than 340 favor a charter school for grades K through 5. (b) Find the probability that 415 or more favor a...
Suppose in a local Kindergarten through 12th grade (K - 12) school district, 53 percent of...
Suppose in a local Kindergarten through 12th grade (K - 12) school district, 53 percent of the population favor a charter school for grades K through five. A simple random sample of 600 is surveyed. Calculate the following using the normal approximation to the binomial distribution. (Round your answers to four decimal places. Find the probability that 315 or more favor a charter school for grades K through 5. Find the probability that exactly 300 favor a charter school for...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT