/*1. Modified from Question 35*/
DATA two;
INPUT x y;
DATALINES;
5 2
3 1
5 6
;run;
PROC PRINT; RUN;
data ONE TWO OTHER;
set TWO;
if X eq 5 then output ONE;
if Y lt 5 then output TWO;
/*original was simply "OUTPUT;"*/
else if output;
run;
title'one';
proc print data=one;run;
title'two';
proc print data=two;run;
title 'other';
proc print data=other;run;
/*Asking the number of observations in each data sets. I got it wrong, but I think the correct answer
is: two obs in dataset one; two obs in dataset two*/
/*2. Modified from Question 46*/
DATA one;
/*one blank value for one more indicator Revenue2007*/
INPUT Revenue2007 Revenue2008 Revenue2009 Revenue2010;
DATALINES;
. 1.2 1.6 2.0
;
;run;
proc print;run;
data WORK.TWO;
set WORK.ONE;
Total=mean(of Rev:);
run;
proc print;run;
/*The value of total should be 1.6*/
/*3. Another question asking to calculate the total of three quarter's values using arrays
keypoint: http://support.sas.com/kb/41/380.html
using * to refer to all elements in the array
_sum_ = sum(of array_name
_avg_ = mean(of array_name
/*4. Proc Means calculates the average of
"all non-missing numeric"
"all missing and non-missing numeric"
"all non-missing numeric and numbers stored as characters"
"all missing and non-missing numeric and numbers stored as characters"
I chose the 1st one, hoping it's right