Question

In: Statistics and Probability

You inherited the following SAS program. Add all the necessary statements to: a) Create two new...

You inherited the following SAS program. Add all the necessary statements to:

a) Create two new variables. Call one OVERALL, computed as the average of the IQ score, the MATH score, and the SCIENCE score divided by 500. Call the other GROUP, defined as 1 for IQ scores between 0 and 100 (inclusive), 2 for IQ cores between 101 and 140 (inclusive), and 3 for IQ greater than 140.


b) Provide a listing of this data set in IQ order.


c) Compute the frequencies for GROUP.

DATA IQ_AND_TEST_SCORES;

INPUT ID    1-3
IQ    4-6
   MATH 7-9
   SCIENCE 10-12;

DATALINES;
001128550590
002102490501
003140670690
004115510510;

Solutions

Expert Solution

Solution-A:

a) Create two new variables. Call one OVERALL, computed as the average of the IQ score, the MATH score, and the SCIENCE score divided by 500. Call the other GROUP, defined as 1 for IQ scores between 0 and 100 (inclusive), 2 for IQ cores between 101 and 140 (inclusive), and 3 for IQ greater than 140.

use data step to create dataset

sum statement to sum IQ MATH and SCIENCE scores divide by 500 and load it into AVERAGE

with if statement give oconditions

lt--means less than

le-less than or equal to

gt--greater than

SAS CODE:

DATA IQ_AND_TEST_SCORES;
INPUT ID 1-3
IQ 4-6
MATH 7-9
SCIENCE 10-12;
DATALINES;
001128550590
002102490501
003140670690
004115510510
;
RUN;

DATA IQ_AND_TEST_SCORES;
SET IQ_AND_TEST_SCORES;
AVERAGE=(sum(IQ,MATH,SCIENCE)/500);
IF IQ GE 0 AND IQ LE 100 THEN GROUP = 1;
IF IQ GE 101 AND IQ LE 140 THEN GROUP = 2;
IF IQ GT 140 THEN GROUP = 3;
RUN;

proc print data=IQ_AND_TEST_SCORES;

run;

Output:

Solution-b:

use proc sort to sort the dataset by IQ

and use proc print to get the listing report

SAS CODE:

proc sort data=IQ_AND_TEST_SCORES;
by IQ;
run;
proc print data=IQ_AND_TEST_SCORES;
run;

Solution-c:

use proc freq to get the frequencies

proc freq data=IQ_AND_TEST_SCORES;
tables group;
run;

Output:


Related Solutions

Write a Python program to (a) create a new empty stack. Then, (b) add items onto...
Write a Python program to (a) create a new empty stack. Then, (b) add items onto the stack. (c) Print the stack contents. (d) Remove an item off the stack, and (e) print the removed item. At the end, (f) print the new stack contents:
In Java create a program that does the following. Suppose you shop for rice in two...
In Java create a program that does the following. Suppose you shop for rice in two different packages. You would like to write a program to compare the cost. The program prompts the user to enter the weight and price of each package and displays the one with the better price. Here are two sample runs: Enter the weight for package 1: 50 Enter the price for package 1: 24.59 Enter the weight for package 2: 25 Enter the price...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables:...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int) * Method YTK() = 12 - SchoolYear; 2. Main *Enter name *Enter age *You will attend school:____ years before graduating.
Create a new project in BlueJ. Create two new classes in the project, with the following...
Create a new project in BlueJ. Create two new classes in the project, with the following specifications: Class name: Part Fields: id (int) description (String) price (double) onSale (boolean) 1 Constructor: takes parameters partId, partDescrip, and partPrice to initialize fields id, description, and price; sets onSale field to false. Methods: Write get-methods (getters) for all four fields. The getters should be named getId, getDescription, getPrice, and isOnSale.
11.       Which of the following statements is CORRECT?             a.         If you add enough...
11.       Which of the following statements is CORRECT?             a.         If you add enough randomly selected stocks to a portfolio, you can completely eliminate all of the market risk from the portfolio.             b.         If you were restricted to investing in publicly traded common stocks, yet you wanted to minimize the riskiness of your portfolio as measured by its beta, then according to the CAPM theory you should invest an equal amount of money in each stock...
Which following statement(s) about SAS names is/are correct? Check all that apply. A. A SAS variable...
Which following statement(s) about SAS names is/are correct? Check all that apply. A. A SAS variable name starts with a letter or an underscore and continues with any combination of numbers, letters, or underscores as the same as library reference names and data set names. B. A SAS library references name must be 8 characters or less and begin with a letter or an underscore. C. A SAS data set names are 1 to 32 characters in length and are...
Create a simple dice game in Java. Add screenshots and the program here.
Create a simple dice game in Java. Add screenshots and the program here.
In this class add Comparable interface. In the driver program create a few objects and In...
In this class add Comparable interface. In the driver program create a few objects and In the driver program create a few objects and compare them . then create a list of those objects and sort them .A Quadratic is bigger than another Quadratic if it opens faster package pack2; /** * This is a program for defining a quadratic equation * @author sonik */ public class Quadratic { public int coeffX2 = 0; public int coeffX = 0; public...
Using C++, you will create a program, where you will create two doubly linked lists. These...
Using C++, you will create a program, where you will create two doubly linked lists. These doubly linked lists will contain integers within them. Using the numbers in both of these linked lists, you add the numbers together, and insert the addition of the two numbers into a singly linked list. the input can be from the user or you just write the input. for example, if one number in the doubly linked list is 817 and in the other...
JAVA Program: You are a developer for a company that wants to create a new payroll...
JAVA Program: You are a developer for a company that wants to create a new payroll system. Write a program that can be used to calculate an employee’s take home pay. Example - rmckanryProgram1. Creating a flow chart or using stump code to outline your program first may help. Include the following features in the program: Enter employee’s name Enter employee’s base hourly pay Enter the number of hours worked for the week Error if the hours worked exceeds 168...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT