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:
Modify the attached files to do the following in java: 1) Add all necessary Getters and...
Modify the attached files to do the following in java: 1) Add all necessary Getters and Setters to the Class file. 2) Add code to compare two instances of the class to see which one comes before the other one based on the zipcode. //Address1.java public class Address {    // attributes    private String street, aptNum, city, state;    private int zip;    // constructors    public Address(String street, String aptNum, String city, String state, int zip)    {...
Writing a Modular Program in Java In this lab, you add the input and output statements...
Writing a Modular Program in Java In this lab, you add the input and output statements to a partially completed Java program. When completed, the user should be able to enter a year, a month, and a day to determine if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31. Instructions Notice that variables have been declared for you....
Writing a Modular Program in Python In this lab, you add the input and output statements...
Writing a Modular Program in Python In this lab, you add the input and output statements to a partially completed Python program. When completed, the user should be able to enter a year, a month, and a day. The program then determines if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31. Instructions Notice that variables have been declared...
For this program you will add and test 2 new member functions to the class in...
For this program you will add and test 2 new member functions to the class in //************************ intSLList.h ************************** // singly-linked list class to store integers #ifndef INT_LINKED_LIST #define INT_LINKED_LIST class IntSLLNode { public: IntSLLNode() { next = 0; } IntSLLNode(int el, IntSLLNode *ptr = 0) { info = el; next = ptr; } int info; IntSLLNode *next; }; class IntSLList { public: IntSLList() { head = tail = 0; } ~IntSLList(); int isEmpty() { return head == 0; }...
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.
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...
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.
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT