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;

  1. What variables will be in dataset all?
  2. 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;)?

  1. set one two;
  2. set one

two(rename=(sale=saleprof));

  1. set two one;
  2. set one one two;
  3. set one(rename=(area=region))

two;

  1. 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

  1. 80 10 0.01
  2. 81 11 0.01
  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!