#4.Given the following SAS data set ONE:
ONE
REP COST
SMITH 200
SMITH 400
JONES 100
SMITH 600
JONES 100
JONES 200
JONES 400
SMITH 800
JONES 100
JONES 300
The following SAS program is submitted:
proc sql;
select rep, avg(cost) as AVERAGE from one
group by rep
having avg(cost) > (select avg(cost) from one);
quit;
Which one of the following reports is generated?
A.
REP AVERAGE
JONES 200
B.
REP AVERAGE
JONES 320
C.
REP AVERAGE
SMITH 320
D.
REP AVERAGE
SMITH 500
[정답] D
[풀이]
proc sql;
select rep, avg(cost) as AVERAGE from one /* rep변수와 cost변수의 평균 변수*/
group by rep /*특정값들을 그룹으로 묶고 그룹안에서 사칙연산 가능*/
having avg(cost) > (select avg(cost) from one);
/*having : group by 에서 조건을 주어 사용*/
quit;
avg(cost)는 320. rep 그룹별 320보다 크면 출력.
smith 그룹의 평균은 500.
jones 그룹의 평균은 200.
320보다 큰 smith 500이 출력됩니다.
proc sort data = sales tagsort;
by month year;
run;
6. The following SAS program is submitted:
data one;
do i = 1 to 10;
ptobs = ceil(ranuni(0) * totobs);
set temp point = ptobs nobs = totobs;
output;
end;
stop;
run;
The SAS data set TEMP contains 2,500,000 observations.
Which one of the following represents the possible values for PTOBS?
A. any integer between 1 and 10
B. any real number between 0 and 1
C. any integer between 1 and 2,500,000
D. any real number between 1 and 2,500,000
[정답]C
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!