Question

1. The following problem uses the SAS sashelp.baseball data set. Create a SAS code to... (a) Calc...

1. The following problem uses the SAS sashelp.baseball data set. Create a SAS code to...

(a) Calculate and report the mean number of Home Runs (nHome) for all the observations in the

entire data set. Call this number the "population mean" Home Runs.

(b) Write a program that will automatically select the first 50 odd-numbered observations in the data set

(i.e., the 1st, 3rd, 5th, ..., 99th observations). Calculate and report the sample mean Home Runs (nHome)

for this selected systematic sample.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

data baseball;
   set sashelp.baseball;
run;

/*Par a > Mean of home runs */

proc means data = baseball;
   var nhome;
   output out = hmean
       mean = hmean;
run;

/*Part b> taking sample - first 50 odd number obs*/

data sample;
   set baseball;
   if _n_ = 1 then ord = 1;
   else ord+1;
   if mod(_n_,2) = 1 then output;
   if ord >=100 then stop;
run;

proc means data = sample;
   var nhome;
   output out = shmean
       mean = shmean;
run;

The MEANS Procedure Analysis Variable :ntome Home Runs in 1986 Mean Std Dev Minimum Maximum 322 11.1024845 8.6987696 0 40.000

Add a comment
Know the answer?
Add Answer to:
1. The following problem uses the SAS sashelp.baseball data set. Create a SAS code to... (a) Calc...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. The following problem uses the SAS sashelp.baseball data set. Create a SAS code to... (a) Writ...

    1. The following problem uses the SAS sashelp.baseball data set. Create a SAS code to... (a) Write a program that will automatically select the first 50 even-numbered observations in the data set (i.e., the 2nd, 4th, 6th, ..., 100th observations). Calculate and report the sample mean Home Runs (nHome) for this selected systematic sample. (b) Write a program that will randomly select 50 observations (WITH replacement) in the data set.

  • Which of the following SAS programs would NOT create a SAS data set consisting only of...

    Which of the following SAS programs would NOT create a SAS data set consisting only of observations with the variable color equal to red? (The answer is not C I am getting the question wrong. Please help a. DATA favorites (WHERE=(color='red')); SET class; RUN; b. DATA favorites; SET class; IF color = 'red'; RUN; c. All of these programs create a SAS data set consisting only of observations where color is equal to red. d. PROC PRINT DATA=class; WHERE color='red';...

  • SAS code for problem: title 'grocery questions'; data a; /* This data set will be a temporary sas...

    SAS code for problem: title 'grocery questions'; data a; /* This data set will be a temporary sas file with name 'a' . In this example we don't need to refer to this name as if there is only one temporary sas file in use, any procedure will automatically use it. */ input y x1 x2 x3 ; /* names input variables */ cards; 4264 305657 7.17 0 4496 328476 6.2 0 4317 317164 4.61 0 4292 366745 7.02 0...

  • can anyone help with a MatLab code? Problem create a function that takes in the following...

    can anyone help with a MatLab code? Problem create a function that takes in the following vector DATA and returns the number of elements, the mean and the sum of the elements. You can call the function ANALYZER DATA [2 4 5 6 7 8];

  • Problem 1 The following data are from a research project on the effectiveness of a drug in reducing LDL chole...

    Problem 1 The following data are from a research project on the effectiveness of a drug in reducing LDL cholesterol levels. While some patients in the study are assigned to the drug, others were given a placebo. Because the information about who is receiving the actual drug is kept confidential from those taking LDL measurements, that information is kept in a separate data set. Given below in Data Set A are the initial LDL cholesterol level of each individual before...

  • I would need both SAS & R code, the output and .txt file/s, please. Because many...

    I would need both SAS & R code, the output and .txt file/s, please. Because many HMOs either do not cover mental health costs or provide only minimal coverage, min- isters and priests often need to provide counseling to persons suffering from mental illness. An in- terdenominational organization wanted to determine whether the clerics from different religions have different levels of awareness with respect to the causes of mental illness. Fifteen clerics from different Christian denominations were sampled. Each was...

  • Use R to do the following. please provide the code Import the data set `UScereal`, create...

    Use R to do the following. please provide the code Import the data set `UScereal`, create a scatter plot of `calories` modeled by `sugars` using the `shelf` variable to create different plot characters. Add a legend to indicate the shelf number. Is there any patterns? (Use base R plotting for this problem.)

  • Consider the following stem and leaf display for a set of sample data. Stem Leaves (unit...

    Consider the following stem and leaf display for a set of sample data. Stem Leaves (unit = 0.01) 0 |9 1 |5 6 2 |1 a 8 9 3 |2 3 5 7 8 4 |4 5 b 9 5 |2 3 9      (a) (i) Find the 1st Quartile (?1) and 3rd Quartile (?3) in terms of a and b. (2 marks) (ii) Suppose the inter-quartile range is 0.22 and the distances between the two quartiles and the median...

  • The following is a multi-part problem, report the r code used for the following 1. Obtain...

    The following is a multi-part problem, report the r code used for the following 1. Obtain 854 values at random from a uniform distribution where the smallest possible value is 10 and largest is 30. name the vector ex2. Consider ex2 the population. 2. Generate a histogram of ex2 3. Randomly obtain 7 samples with 10 observations in each sample from ex2 using sampling with replacement. Name the vector sam7. Calculate the mean for each sample and name that object...

  • The following data set represents the number of NBA games in January 2016, watched by 10...

    The following data set represents the number of NBA games in January 2016, watched by 10 randomly selected student in STAT 206. 7, 0, 4, 2, 2, 1, 0, 1, 2, 3 (a) What is the sample mean? (b) Calculate sample variance. (c) Estimate the mean number of NBA games watched by a student in January 2016. (d) Estimate the standard error of the estimated mean.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT