Question
Stat 6605: SAS Programming Assignment 3 1. Set up arrays to meet the following requirements: a. Array name Test has 20 numeric elements, Test1 through
Stat 6605: SAS Programming
Assignment 3
1. Set up arrays to meet the following requirements:
a. Array name Test has 20 numeric elements, Test1 through Test20. Write the array statement two ways.
b. Array math has three elements, Jan, Feb and Mar. Their initial values are "January", "February" and "March". Since the array statement will be the first reference to these variables, pay particular attention to their length.
2. What, if anything, is wrong with the following data step program fragments?
a. array x{20};
total=0;
do i=1 to 25 by 2;
total=sum(x(i), total);
end;
b. array x{20};
n=0;
do i=1 to 25 by 2;
n=n+1;
total=sum(x(n), total);
end;
c. do i=0.07 to 0.08;
3. Examine the following data step:
data all;
infile 'ubaacs.survey.tariff ';
input type $1. @;
if type='m' then do;
input nreps 2. id $2.;
do i=1 to nreps;
input uear rate;
output;
end;
end;
run;
- What variables will be in dataset all?
- Suppose the raw dataset identified by the infile statement looked like this:
m 3us
87 5.4
88 5.15
89 5.0
i 1us
9.7 11.2
m 2it
88 6.0
89 5.8
What will dataset all look like?
4. Datasets one and two look like this
Data one: area saleprof Data two: area sale
n 230 n 220
n 210 e 110
ne 340 ne 210
s 170 ma 180
s 120
What do dataset both look like if the following set statement and program statements are used (assume the data statement is simply data both;)?
- set one two;
- set one
two(rename=(sale=saleprof));
- set two one;
- set one one two;
- set one(rename=(area=region))
two;
- set one(in=p1)
two(in=p2);
if p1=1 then which ='1st';
else which ='2nd';
5. Datasets one and two look like this:
Data one: lot npass data two: lot pctfail
- 80 10 0.01
- 81 11 0.01
- 72 11 0.05
15 70 15 0.10
20 0.08
20 0.09
What does dataset both look like by interleaving these datasets in different order?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started