SEMESTER 1 – END OF SEMESTER TEST 2019
VerifiedAdded on 2022/11/26
|17
|2392
|292
AI Summary
This document is the end of semester test for Math 1322 - Introduction to Statistical Computing. It includes questions on product sales, public transport journeys, agility dog trials, and heart study data. The test consists of six questions covering various topics related to statistical computing. The questions require the use of SAS code to analyze and summarize data. The test is worth a total of 40 marks and contributes 40% to the final grade.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
School of Science
SEMESTER 1 – END OF SEMESTER TEST 2019
Math 1322 – Introduction to Statistical Computing
Date: Monday, 27 May 2019 Time Allowed: 2 hours + 15 minutes reading
Time: 6:45 pm - 9:00 pm No. of pages: 9 pages
INSTRUCTIONS:
1. Candidates should answer all six (6) questions. This paper is worth a total of 40 marks and
contributes 40% of your final grade.
2. Candidates may take lecture notes, assignments and printed or written material into the
test. They may access the internet but must not open message/mail facilities of any kind.
3. Reading time of 15 minutes is included. You can download the files during this time, but no
other computing should be done during reading time.
4. At the end of each question paste your SAS code into this document in the box provided.
5. The data sets needed are on Canvas under Assignments on the Test 2 Page. Save the files to
your own drive before carrying out any analyses. An electronic version of this paper to be
used for all of your answers and output where requested. This paper
(MATH1322_Test_2_2019) is available on Canvas as part of Test 2 for you to download.
6. At the completion of the exam you MUST upload to Canvas, your electronic version of:
i. your answers in this Word document (including SAS code used).
ii. your SAS code file (ONE file only)
A window of 10 minutes is available at the completion of the test to upload your
submission files. No further work is permitted during this upload time or you will
receive a zero grade. Any submissions after this time will not be considered and will
receive zero.
SAVE ALL OF YOUR WORK AS YOU GO
SEMESTER 1 – END OF SEMESTER TEST 2019
Math 1322 – Introduction to Statistical Computing
Date: Monday, 27 May 2019 Time Allowed: 2 hours + 15 minutes reading
Time: 6:45 pm - 9:00 pm No. of pages: 9 pages
INSTRUCTIONS:
1. Candidates should answer all six (6) questions. This paper is worth a total of 40 marks and
contributes 40% of your final grade.
2. Candidates may take lecture notes, assignments and printed or written material into the
test. They may access the internet but must not open message/mail facilities of any kind.
3. Reading time of 15 minutes is included. You can download the files during this time, but no
other computing should be done during reading time.
4. At the end of each question paste your SAS code into this document in the box provided.
5. The data sets needed are on Canvas under Assignments on the Test 2 Page. Save the files to
your own drive before carrying out any analyses. An electronic version of this paper to be
used for all of your answers and output where requested. This paper
(MATH1322_Test_2_2019) is available on Canvas as part of Test 2 for you to download.
6. At the completion of the exam you MUST upload to Canvas, your electronic version of:
i. your answers in this Word document (including SAS code used).
ii. your SAS code file (ONE file only)
A window of 10 minutes is available at the completion of the test to upload your
submission files. No further work is permitted during this upload time or you will
receive a zero grade. Any submissions after this time will not be considered and will
receive zero.
SAVE ALL OF YOUR WORK AS YOU GO
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
QUESTION 1
The file Chips.csv on Canvas contains information on product sales. Use this file to answer the
following questions.
a) Read the information into SAS using a DATA step.
b) Using one SAS procedure, produce a detailed summary of the quantity sold, including a
normal distribution plot.
c) Using SAS code, create a new variable to show the month of Sale, and label your column
“Month”.
d) Create a table of just the records of the chips sold in December.
e) Produce a histogram to show the quantity sold in December using your table from part
d). Include below.
(2+1.5+1.5+1+1 = 7 marks)
Question 1 Answers and SAS Code
%let path=/folders/myfolders/Sample Data;
libname analysis "&path";
DATA analysis.chipdata;
infile "&path/chips.csv"
delimiter=','
firstobs=2
missover
DSD;
informat Date Date9.;
format Date Date9.;
input QtySold Price Advertised Holiday Date Product$;
run;
proc contents data=analysis.chipdata;
run;
proc means data=analysis.chipdata;
var QtySold;
run;
proc univariate data=analysis.chipdata;
var QtySold;
The file Chips.csv on Canvas contains information on product sales. Use this file to answer the
following questions.
a) Read the information into SAS using a DATA step.
b) Using one SAS procedure, produce a detailed summary of the quantity sold, including a
normal distribution plot.
c) Using SAS code, create a new variable to show the month of Sale, and label your column
“Month”.
d) Create a table of just the records of the chips sold in December.
e) Produce a histogram to show the quantity sold in December using your table from part
d). Include below.
(2+1.5+1.5+1+1 = 7 marks)
Question 1 Answers and SAS Code
%let path=/folders/myfolders/Sample Data;
libname analysis "&path";
DATA analysis.chipdata;
infile "&path/chips.csv"
delimiter=','
firstobs=2
missover
DSD;
informat Date Date9.;
format Date Date9.;
input QtySold Price Advertised Holiday Date Product$;
run;
proc contents data=analysis.chipdata;
run;
proc means data=analysis.chipdata;
var QtySold;
run;
proc univariate data=analysis.chipdata;
var QtySold;
histogram/normal;
run;
Data analysis.chipdata1;
set analysis.chipdata;
Month=month(Date);
run;
Data chipdec;
set analysis.chipdata1;
if Month=12;
run;
proc univariate data=chipdec;
var QtySold;
histogram;
run;
run;
Data analysis.chipdata1;
set analysis.chipdata;
Month=month(Date);
run;
Data chipdec;
set analysis.chipdata1;
if Month=12;
run;
proc univariate data=chipdec;
var QtySold;
histogram;
run;
QUESTION 2
The datafile train.csv details the journeys by public transport users and whether they have
previously made a complaint about service. Use this file to answer the following questions.
a) Read the information into SAS using a DATA step. Ensure this is formatted accordingly.
b) Provide an overview of the dataset to ensure it has read in correctly.
c) Determine whether someone has a long (greater than 30 km) or short commute and
create a new column using SAS code to show this.
d) Summarise the number of complaints based on the commute status that you created in
part c) above, show the overall percentage as well as the counts (only these two figures
and include the totals). Include below.
(2+1+2+2 = 7 marks)
Question 2 Answers and SAS Code
DATA analysis.train;
infile "&path/train.csv"
delimiter=','
firstobs=2
missover
dsd;
informat Date ddmmyy10.;
format Date Date9.;
input Record Date Distance Time Complaint $ Survey_m $
;
run;
proc contents data=analysis.train;
run;
data train2;
set analysis.train;
if Distance < 30 then commute='Short';
else if Distance > 30 then commute='Long';
run;
proc freq data=train2;
tables commute * Complaint commute Complaint;
run;
The datafile train.csv details the journeys by public transport users and whether they have
previously made a complaint about service. Use this file to answer the following questions.
a) Read the information into SAS using a DATA step. Ensure this is formatted accordingly.
b) Provide an overview of the dataset to ensure it has read in correctly.
c) Determine whether someone has a long (greater than 30 km) or short commute and
create a new column using SAS code to show this.
d) Summarise the number of complaints based on the commute status that you created in
part c) above, show the overall percentage as well as the counts (only these two figures
and include the totals). Include below.
(2+1+2+2 = 7 marks)
Question 2 Answers and SAS Code
DATA analysis.train;
infile "&path/train.csv"
delimiter=','
firstobs=2
missover
dsd;
informat Date ddmmyy10.;
format Date Date9.;
input Record Date Distance Time Complaint $ Survey_m $
;
run;
proc contents data=analysis.train;
run;
data train2;
set analysis.train;
if Distance < 30 then commute='Short';
else if Distance > 30 then commute='Long';
run;
proc freq data=train2;
tables commute * Complaint commute Complaint;
run;
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
QUESTION 3
There are two datafiles on Canvas agility.sas7bdat and place.sas7bdat. These files show the results
from the ADVC Excellence Agility class dog trials for Easter 2019. Use these files to answer the
following questions.
a) Create a libref to point to the location that you have saved these files.
b) Using one SAS code step, bring the information together to show the placing results for each
competitor for the Excellence Agility (B) group only. Use table aliases where appropriate.
c) Note that one of the owners names is not recorded, use SAS code to find the row from your
table in part b) that has no owner listed.
d) Use SAS code to determine if a similarly named dog is present in the agility table (to the one
found in part c) where no owner is recorded).
(1+2.5+1+1.5 = 6 marks)
Question 3 Answers and SAS Code
%let path=/folders/myfolders/Sample Data;
libname analysis "&path";
proc SQl;
create table agg as
select a.* , b.*
from analysis.agility as a
left join
analysis.place as b
on a.catnum=b.catno
where a.event="Excellent Agility (B)";
quit;
Data own_null;
set agg;
if owner= " ";
put _all_;
run;
Proc SQL;
create table dog as
select a.Dog
from analysis.agility as a
inner join
own_null as b
There are two datafiles on Canvas agility.sas7bdat and place.sas7bdat. These files show the results
from the ADVC Excellence Agility class dog trials for Easter 2019. Use these files to answer the
following questions.
a) Create a libref to point to the location that you have saved these files.
b) Using one SAS code step, bring the information together to show the placing results for each
competitor for the Excellence Agility (B) group only. Use table aliases where appropriate.
c) Note that one of the owners names is not recorded, use SAS code to find the row from your
table in part b) that has no owner listed.
d) Use SAS code to determine if a similarly named dog is present in the agility table (to the one
found in part c) where no owner is recorded).
(1+2.5+1+1.5 = 6 marks)
Question 3 Answers and SAS Code
%let path=/folders/myfolders/Sample Data;
libname analysis "&path";
proc SQl;
create table agg as
select a.* , b.*
from analysis.agility as a
left join
analysis.place as b
on a.catnum=b.catno
where a.event="Excellent Agility (B)";
quit;
Data own_null;
set agg;
if owner= " ";
put _all_;
run;
Proc SQL;
create table dog as
select a.Dog
from analysis.agility as a
inner join
own_null as b
on a.dog=b.dog;
quit;
quit;
QUESTION 4
The SASHELP file HEART contains information on the Framingham Heart Study. Use this information
to answer the following questions.
a) Create a boxplot of the patients diastolic blood pressure, that on the one graph, shows the
comparison between males and females and their smoking status. Ensure your graph is
appropriately labelled on your axes with “Diastolic BP” and “Prior Smoking Status” and
include a title. Include below.
b) Using PROC SQL, create a table that provide a count of weight status, based on their status
at the end of the study. Show their status and weight status alongside the count.
c) Find the average age, by gender for this cohort.
d) Using SAS code, save your output from part c) to a PDF file. (Note you do not need to upload
this file, just include the correct code below).
(3+2+1.5+1 = 7.5 marks)
Question 4 Answers and SAS Code
ods pdf file='/folders/myfolders/Sample Data/heart.pdf';
proc sort data=sashelp.heart
out=heart_sorted ;
by Smoking_Status Sex ;
run ;
proc sgpanel data=sashelp.heart;
panelby sex ;
colaxis label="Diastolic BP";
rowaxis label="Prior Smoking Status";
vbox diastolic /category=Smoking_Status;
run ;
Proc SQL;
create table aged as
select status, weight_status, count(weight_status) as count
from sashelp.heart
group by status, weight_status;
quit;
proc sql;
create table gend as
select Sex, mean(AgeAtDeath) as avg_death ,mean(AgeAtstart) as age_strt
from sashelp.heart
group by Sex;
quit;
The SASHELP file HEART contains information on the Framingham Heart Study. Use this information
to answer the following questions.
a) Create a boxplot of the patients diastolic blood pressure, that on the one graph, shows the
comparison between males and females and their smoking status. Ensure your graph is
appropriately labelled on your axes with “Diastolic BP” and “Prior Smoking Status” and
include a title. Include below.
b) Using PROC SQL, create a table that provide a count of weight status, based on their status
at the end of the study. Show their status and weight status alongside the count.
c) Find the average age, by gender for this cohort.
d) Using SAS code, save your output from part c) to a PDF file. (Note you do not need to upload
this file, just include the correct code below).
(3+2+1.5+1 = 7.5 marks)
Question 4 Answers and SAS Code
ods pdf file='/folders/myfolders/Sample Data/heart.pdf';
proc sort data=sashelp.heart
out=heart_sorted ;
by Smoking_Status Sex ;
run ;
proc sgpanel data=sashelp.heart;
panelby sex ;
colaxis label="Diastolic BP";
rowaxis label="Prior Smoking Status";
vbox diastolic /category=Smoking_Status;
run ;
Proc SQL;
create table aged as
select status, weight_status, count(weight_status) as count
from sashelp.heart
group by status, weight_status;
quit;
proc sql;
create table gend as
select Sex, mean(AgeAtDeath) as avg_death ,mean(AgeAtstart) as age_strt
from sashelp.heart
group by Sex;
quit;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
ods pdf close;
QUESTION 5
The information in the table below is the official international interest rates over a three year period.
Use this information to answer the following questions.
Publication
Date US
Bank of
Japan
European Central
Bank
Bank of
England
Bank of
Canada RBA
01Apr2016 0.38 -0.10 0.00 0.50 0.50 2.00
01May2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Jun2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Jul2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Aug2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Sep2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Oct2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Nov2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Dec2016 0.63 -0.10 0.00 0.25 0.50 1.50
01Jan2017 0.63 -0.10 0.00 0.25 0.50 1.50
01Feb2017 0.63 -0.10 0.00 0.25 0.50 1.50
01Mar2017 0.88 -0.10 0.00 0.25 0.50 1.50
01Apr2017 0.88 -0.10 0.00 0.25 0.50 1.50
01May2017 0.88 -0.10 0.00 0.25 0.50 1.50
01Jun2017 1.13 -0.10 0.00 0.25 0.50 1.50
01Jul2017 1.13 -0.10 0.00 0.25 0.75 1.50
01Aug2017 1.13 -0.10 0.00 0.25 0.75 1.50
01Sep2017 1.13 -0.10 0.00 0.25 1.00 1.50
01Oct2017 1.13 -0.10 0.00 0.25 1.00 1.50
01Nov2017 1.13 -0.10 0.00 0.50 1.00 1.50
01Dec2017 1.38 -0.10 0.00 0.50 1.00 1.50
01Jan2018 1.38 -0.10 0.00 0.50 1.25 1.50
01Feb2018 1.38 -0.10 0.00 0.50 1.25 1.50
01Mar2018 1.63 -0.10 0.00 0.50 1.25 1.50
01Apr2018 1.63 -0.10 0.00 0.50 1.25 1.50
01May2018 1.63 -0.10 0.00 0.50 1.25 1.50
01Jun2018 1.88 -0.10 0.00 0.50 1.25 1.50
01Jul2018 1.88 -0.10 0.00 0.50 1.50 1.50
01Aug2018 1.88 -0.10 0.00 0.75 1.50 1.50
01Sep2018 2.13 -0.10 0.00 0.75 1.50 1.50
01Oct2018 2.13 -0.10 0.00 0.75 1.75 1.50
01Nov2018 2.13 -0.10 0.00 0.75 1.75 1.50
01Dec2018 2.38 -0.10 0.00 0.75 1.75 1.50
01Jan2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Feb2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Mar2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Apr2019 2.38 -0.10 0.00 0.75 1.75 1.50
a) Read the information into SAS using a DATA step. Ensure the variables are formatted
appropriately.
b) Print a table of the first five RBA rates, starting in May 2016. Include your table below.
The information in the table below is the official international interest rates over a three year period.
Use this information to answer the following questions.
Publication
Date US
Bank of
Japan
European Central
Bank
Bank of
England
Bank of
Canada RBA
01Apr2016 0.38 -0.10 0.00 0.50 0.50 2.00
01May2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Jun2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Jul2016 0.38 -0.10 0.00 0.50 0.50 1.75
01Aug2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Sep2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Oct2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Nov2016 0.38 -0.10 0.00 0.25 0.50 1.50
01Dec2016 0.63 -0.10 0.00 0.25 0.50 1.50
01Jan2017 0.63 -0.10 0.00 0.25 0.50 1.50
01Feb2017 0.63 -0.10 0.00 0.25 0.50 1.50
01Mar2017 0.88 -0.10 0.00 0.25 0.50 1.50
01Apr2017 0.88 -0.10 0.00 0.25 0.50 1.50
01May2017 0.88 -0.10 0.00 0.25 0.50 1.50
01Jun2017 1.13 -0.10 0.00 0.25 0.50 1.50
01Jul2017 1.13 -0.10 0.00 0.25 0.75 1.50
01Aug2017 1.13 -0.10 0.00 0.25 0.75 1.50
01Sep2017 1.13 -0.10 0.00 0.25 1.00 1.50
01Oct2017 1.13 -0.10 0.00 0.25 1.00 1.50
01Nov2017 1.13 -0.10 0.00 0.50 1.00 1.50
01Dec2017 1.38 -0.10 0.00 0.50 1.00 1.50
01Jan2018 1.38 -0.10 0.00 0.50 1.25 1.50
01Feb2018 1.38 -0.10 0.00 0.50 1.25 1.50
01Mar2018 1.63 -0.10 0.00 0.50 1.25 1.50
01Apr2018 1.63 -0.10 0.00 0.50 1.25 1.50
01May2018 1.63 -0.10 0.00 0.50 1.25 1.50
01Jun2018 1.88 -0.10 0.00 0.50 1.25 1.50
01Jul2018 1.88 -0.10 0.00 0.50 1.50 1.50
01Aug2018 1.88 -0.10 0.00 0.75 1.50 1.50
01Sep2018 2.13 -0.10 0.00 0.75 1.50 1.50
01Oct2018 2.13 -0.10 0.00 0.75 1.75 1.50
01Nov2018 2.13 -0.10 0.00 0.75 1.75 1.50
01Dec2018 2.38 -0.10 0.00 0.75 1.75 1.50
01Jan2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Feb2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Mar2019 2.38 -0.10 0.00 0.75 1.75 1.50
01Apr2019 2.38 -0.10 0.00 0.75 1.75 1.50
a) Read the information into SAS using a DATA step. Ensure the variables are formatted
appropriately.
b) Print a table of the first five RBA rates, starting in May 2016. Include your table below.
c) Calculate the correlation between the US and the RBA. Include your output table below.
d) Use SAS code, extract the Year from the Publication Date to create a new column.
e) Calculate the average interest rate for each year for the RBA using PROC SQL.
(2+1.5+1.5+1+1.5 = 7.5 marks)
Question 5 Answers and SAS Code
DATA Sample;
input @1Date date9. @11 US 4. @16 Bank_Japan 5.
@22 EuropeancBank 4.
@27 BankEng 4. @32 BankCan 4.
@37 RBA 4. ;
format Date Date9.;
datalines;
01Apr2016 0.38
-0.10
0.00
0.50
0.50
2.00
01May2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Jun2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Jul2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Aug2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Sep2016 0.38
d) Use SAS code, extract the Year from the Publication Date to create a new column.
e) Calculate the average interest rate for each year for the RBA using PROC SQL.
(2+1.5+1.5+1+1.5 = 7.5 marks)
Question 5 Answers and SAS Code
DATA Sample;
input @1Date date9. @11 US 4. @16 Bank_Japan 5.
@22 EuropeancBank 4.
@27 BankEng 4. @32 BankCan 4.
@37 RBA 4. ;
format Date Date9.;
datalines;
01Apr2016 0.38
-0.10
0.00
0.50
0.50
2.00
01May2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Jun2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Jul2016 0.38
-0.10
0.00
0.50
0.50
1.75
01Aug2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Sep2016 0.38
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
-0.10
0.00
0.25
0.50
1.50
01Oct2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Nov2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Dec2016 0.63
-0.10
0.00
0.25
0.50
1.50
01Jan2017 0.63
-0.10
0.00
0.25
0.50
1.50
01Feb2017 0.63
-0.10
0.00
0.25
0.50
1.50
01Mar2017 0.88
-0.10
0.00
0.25
0.50
1.50
01Apr2017 0.88
-0.10
0.00
0.25
0.50
1.50
01May2017 0.88
-0.10
0.00
0.25
0.00
0.25
0.50
1.50
01Oct2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Nov2016 0.38
-0.10
0.00
0.25
0.50
1.50
01Dec2016 0.63
-0.10
0.00
0.25
0.50
1.50
01Jan2017 0.63
-0.10
0.00
0.25
0.50
1.50
01Feb2017 0.63
-0.10
0.00
0.25
0.50
1.50
01Mar2017 0.88
-0.10
0.00
0.25
0.50
1.50
01Apr2017 0.88
-0.10
0.00
0.25
0.50
1.50
01May2017 0.88
-0.10
0.00
0.25
0.50
1.50
01Jun2017 1.13
-0.10
0.00
0.25
0.50
1.50
01Jul2017 1.13
-0.10
0.00
0.25
0.75
1.50
01Aug2017 1.13
-0.10
0.00
0.25
0.75
1.50
01Sep2017 1.13
-0.10
0.00
0.25
1.00
1.50
01Oct2017 1.13
-0.10
0.00
0.25
1.00
1.50
01Nov2017 1.13
-0.10
0.00
0.50
1.00
1.50
01Dec2017 1.38
-0.10
0.00
0.50
1.00
1.50
01Jan2018 1.38
-0.10
0.00
0.50
1.25
1.50
01Feb2018 1.38
1.50
01Jun2017 1.13
-0.10
0.00
0.25
0.50
1.50
01Jul2017 1.13
-0.10
0.00
0.25
0.75
1.50
01Aug2017 1.13
-0.10
0.00
0.25
0.75
1.50
01Sep2017 1.13
-0.10
0.00
0.25
1.00
1.50
01Oct2017 1.13
-0.10
0.00
0.25
1.00
1.50
01Nov2017 1.13
-0.10
0.00
0.50
1.00
1.50
01Dec2017 1.38
-0.10
0.00
0.50
1.00
1.50
01Jan2018 1.38
-0.10
0.00
0.50
1.25
1.50
01Feb2018 1.38
-0.10
0.00
0.50
1.25
1.50
01Mar2018 1.63
-0.10
0.00
0.50
1.25
1.50
01Apr2018 1.63
-0.10
0.00
0.50
1.25
1.50
01May2018 1.63
-0.10
0.00
0.50
1.25
1.50
01Jun2018 1.88
-0.10
0.00
0.50
1.25
1.50
01Jul2018 1.88
-0.10
0.00
0.50
1.50
1.50
01Aug2018 1.88
-0.10
0.00
0.75
1.50
1.50
01Sep2018 2.13
-0.10
0.00
0.75
1.50
1.50
01Oct2018 2.13
-0.10
0.00
0.75
0.00
0.50
1.25
1.50
01Mar2018 1.63
-0.10
0.00
0.50
1.25
1.50
01Apr2018 1.63
-0.10
0.00
0.50
1.25
1.50
01May2018 1.63
-0.10
0.00
0.50
1.25
1.50
01Jun2018 1.88
-0.10
0.00
0.50
1.25
1.50
01Jul2018 1.88
-0.10
0.00
0.50
1.50
1.50
01Aug2018 1.88
-0.10
0.00
0.75
1.50
1.50
01Sep2018 2.13
-0.10
0.00
0.75
1.50
1.50
01Oct2018 2.13
-0.10
0.00
0.75
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
1.75
1.50
01Nov2018 2.13
-0.10
0.00
0.75
1.75
1.50
01Dec2018 2.38
-0.10
0.00
0.75
1.75
1.50
01Jan2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Feb2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Mar2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Apr2019 2.38
-0.10
0.00
0.75
1.75
1.50
;
run;
proc print data=sample (obs=5);
var RBA;
where Date>= "01May2016"d;
run;
proc corr data=sample;
var RBA ;
with US;
run;
1.50
01Nov2018 2.13
-0.10
0.00
0.75
1.75
1.50
01Dec2018 2.38
-0.10
0.00
0.75
1.75
1.50
01Jan2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Feb2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Mar2019 2.38
-0.10
0.00
0.75
1.75
1.50
01Apr2019 2.38
-0.10
0.00
0.75
1.75
1.50
;
run;
proc print data=sample (obs=5);
var RBA;
where Date>= "01May2016"d;
run;
proc corr data=sample;
var RBA ;
with US;
run;
data sample_2;
set sample;
year=year(Date);
run;
proc sql;
create table year as
select Year, mean(RBA) as avg
from sample_2
group by Year;
quit;
set sample;
year=year(Date);
run;
proc sql;
create table year as
select Year, mean(RBA) as avg
from sample_2
group by Year;
quit;
QUESTION 6
The recent elections required the mail delivery of party information pamphlet bundles. We want to
determine how many man hours were spent delivering this advertising material, to the 50,000
registered voters in one electorate.
Each person can carry 100 pamphlet bundles, initially they can walk at 1 m/s, but with each delivery
they become 0.01 m/s faster, to a maximum of 1.8 m/s.
a) Create a loop statement in SAS with 20 iterations that will:
i) Show the increase in speed with each delivery and the distance travelled by each person
if the average delivery is 50 m apart. Ensure each iteration is shown in your result table.
ii) Add in a condition to ensure that the speed does not exceed the maximum as specified
above. How many bundles are delivered before maximum walking speed is achieved?
b) Use another code step to determine the total time spent delivering all 100 pamphlet
bundles, and how long this would take to deliver to all 50,000 voters. Hint
speed= distance
time .
(2+2+1= 5 marks)
Question 6 Answers and SAS Code
data a;
speed=1;
distance=0;
do i=1 to 20;
speed+0.01;
distance+50;
bundels+100;
output;
end;
run;
data b;
speed=1;
distance=0;
do while (bundels<50000);
The recent elections required the mail delivery of party information pamphlet bundles. We want to
determine how many man hours were spent delivering this advertising material, to the 50,000
registered voters in one electorate.
Each person can carry 100 pamphlet bundles, initially they can walk at 1 m/s, but with each delivery
they become 0.01 m/s faster, to a maximum of 1.8 m/s.
a) Create a loop statement in SAS with 20 iterations that will:
i) Show the increase in speed with each delivery and the distance travelled by each person
if the average delivery is 50 m apart. Ensure each iteration is shown in your result table.
ii) Add in a condition to ensure that the speed does not exceed the maximum as specified
above. How many bundles are delivered before maximum walking speed is achieved?
b) Use another code step to determine the total time spent delivering all 100 pamphlet
bundles, and how long this would take to deliver to all 50,000 voters. Hint
speed= distance
time .
(2+2+1= 5 marks)
Question 6 Answers and SAS Code
data a;
speed=1;
distance=0;
do i=1 to 20;
speed+0.01;
distance+50;
bundels+100;
output;
end;
run;
data b;
speed=1;
distance=0;
do while (bundels<50000);
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
speed+0.01;
if speed >=1.8 then speed = 1.8;
distance+50;
bundels+100;
output;
end;
run;
data c;
speed=1;
distance=0;
time=0;
do while (bundels<50000);
speed+0.01;
if speed >=1.8 then speed = 1.8;
distance+50;
bundels+100;
t=distance/speed;
time+t;
output;
end;
run;
END OF TEST
Upload this answer document and your SAS code file to Canvas.
if speed >=1.8 then speed = 1.8;
distance+50;
bundels+100;
output;
end;
run;
data c;
speed=1;
distance=0;
time=0;
do while (bundels<50000);
speed+0.01;
if speed >=1.8 then speed = 1.8;
distance+50;
bundels+100;
t=distance/speed;
time+t;
output;
end;
run;
END OF TEST
Upload this answer document and your SAS code file to Canvas.
1 out of 17
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.