BookmarkSubscribeRSS Feed

[SAS Programming]SAS Certified Advanced Programmer 덤프3 풀이 29-31

Started ‎11-06-2020 by
Modified ‎11-06-2020 by
Views 639

 

29.Which one of the following SAS procedures changes a permanent format of a variable stored in a SAS data set?

A. MODIFY
B. FORMAT
C. CONTENTS
D. DATASETS

 

1.png

 
30. 

Given the following SAS data set SASUSER.HIGHWAY:

SASUSER.HIGHWAY 
STEERING  SEATBELT  SPEED  STATUS  COUNT
absent    no        0-29   serious 31
absent    no        0-29   not     1419
absent    no        30-49  serious 191
absent    no        30-49  not     2004
absent    no        50+    serious 216

The following SAS program is submitted:

%macro highway;
proc sql noprint;
    select count(distinct status) into:
        numgrp from sasuser.highway;
    %let numgrp = &numgrp;
    select distinct status into:
        group 1- :group&numgrp from sasuser.highway;
quit;

%do i = 1 %to &numgrp;
proc print data = sasuser.highway;
    where status = "&&group&i";
run;
%end;
%mend;

%highway

How many reports are produced by the above program?

A. 0
B. 1
C. 2
D. 5

 

[정답]C

[풀이]

%macro highway;
proc sql noprint;
    select count(distinct status) into:
        numgrp from sasuser.highway;
    %let numgrp = &numgrp;
    select distinct status into:
        group 1- :group&numgrp from sasuser.highway;
quit;

%do i = 1 %to &numgrp;
proc print data = sasuser.highway;
    where status = "&&group&i";
run;
%end;
%mend;

%highway

 

distinct는 중복없이 유일한 값만 추출하는 함수입니다..
그러므로 serious 그룹과 not그룹으로 나눠저서 2개의 리포트가 생성됩니다.

 

31.Text is sent to the SAS compiler as a result of macro execution.

Which one of the following SAS System options writes that text to the log?

A. MPRINT
B. MLOGIC
C. MSOURCE
D. SOURCE2

 

[정답]A

[풀이]

mprint는 매크로 코드와 매크로에 의해 생성된 SAS코드를 기록합니다. 에러가 중간에 어디 생겼는지 확인가능합니다.

mlogic은 모수의 결정, 변수의 유효범위, 퍙가된 매크로 expression의 상태, loop 반복 수, 각 매크로 실행의 시작과 끝을 포함하여 매크로 실행의 흐름을 출력합니다. 

mlogic 옵션은 프로그램 로직에 버그가 있다고 생각될 때 사용합니다.

 

Comments

You didn't really ask a question, so I guess you are looking for a comment.

 

Depending on how you interpret the question, both PROC FORMAT and PROC DATASETS can accomplish that task.

 

If a variable already has a user-defined format assigned to it, PROC FORMAT lets you change the definition of the format.  SAS would use the new version of the format from that point forward.

 

PROC DATASETS allows you to change variable attributes, including formats.  So you could change which format is permanently assigned to a variable.

Version history
Last update:
‎11-06-2020 07:24 PM
Updated by:
Contributors

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Article Labels
Article Tags