Advanced SAS Test 2 Flashcards
Given the non-indexed SAS data set TEMP: TEMP X Y P 52 P 45 A 13 A 56 R 34 The following SAS program is submitted:
Proc print data=temp;
run;
Which BY statement completes the program, creates a listing report that is grouped by X and completes without errors?
A. By X grouped;
B. By X;
C. By X notsorted;
D. By descending X
C. By X notsorted
Which of the following statement(s) in the DATASETS procedure alters the name of a SAS data set stored in a SAS data library?
A. RENAME statement only
B. CHANGE statement only
C. MODIFY and RENAME statements
D. MODIFY and CHANGE statements
Correct Answer B : The CHANGE Statement
Renames one or more SAS files in the same SAS library.
CHANGE statement changes names by the order that the old-names occur in the directory listing, not in the order that you list the changes in the CHANGE statement.
If the old-name SAS file does not exist in the SAS library, PROC DATASETS stops processing the RUN group containing the CHANGE statement and issues an error message. To override this behavior, use the NOWARN option in the PROC DATASETS statement.
If you change the name of a data set that has an index, the index continues to correspond to the data set.
The RENAME Statement renames variables in the SAS data set specified in the MODIFY statement.
The CHANGE statement changes names by the order that the old-names occur in the directory listing, not in the order that you list the changes in the CHANGE statement.
proc datasets lib=…
change alpha=omega
data set: SASHELP.CLASS NAME AGE Mary 15 Philip 16 Robert 12 The following SAS program is submitted
%let value = Philip; proc print data =sashelp.class;
run;
Which WHERE statement successfully completes the program and produces a report?
A. where upcase(name)=upcase(“&value”)
B. where upcase(name)=”%upcase(&&value)”;
C. where upcase(name)=upcase(&value);
A. where upcase(name)=upcase(“&value”)
Tested
options mprint; %macro test(parm); proc &parm data = sashelp.prdsale; run; %mend; %test(print)
What is the result of the MPRINT options?
A. It writes macro execution messages to the SAS log
B. It echos the text sent to the SAS compiler
B. It echos the text sent to the SAS compiler
No explanation. Macro successfully runs proc print procedure.
At the start of a new SAS session; the following program is submitted:
%macro one; data _null_; call symput('proc','measn); run; proc &proc data=sashelp.class; run; %mend; %one()
What is the result?
A. The program fails to execute because “proc” is a reserved word.
B. The macro variable “proc” is stored in the global symbol table
B. The macro variable “proc” is stored in the global symbol table
The proc means procedure is successfully completed
The following SAS program is submitted:
%let value=9; %let add=5; %let newval=%eval(&value/&add);
What is the value of the macro variable NEWVAL?
A. 1.8
B. 2
C. 1
D. Null
C. 1
EVAL(character) any numeric value other than 0 returns true (1) and a value of 0 is false (0).
Returns number when it is an integer: %eval(7) is 7!
Fails when number is rational %eval(10.8) leads to log error message :
ERROR: A character operand was found in the %EVAL function
Which of the following is true about the COMPRESS=YES data set option?
A. It is most effective with character data that contains repeated characters
B. It is most effective with characters that contain patterns
C. It is most effective with numeric data
A. It is most effective with character data that contains repeated characters
data new;
do i=1,2,3 nextfile=compress('March' || |); infile abc filevar=nextfile end=eof; do until (eof); input dept $sales; end;run;
What is the purpose of the FILEVAR=option on the INFILE statement?
A. It names a variable NEXFILE, whose value is a SAS file reference
B. It names a variable NEXFILE, whose change in value caused the infile statement to open a new input file
B. It names a variable NEXFILE, whose change in value caused the infile statement to open a new input file
The following SAS program is submitted:
data new(bufsize = 6144 bufno = 4);
set old;
run;
What is the difference between the usage of BUFFSIZE= and BUFNO= options?
BUFFSIZE= specifies the size of the output buffer in bytes BUFNO= specifies the number of output buffers
The SAS data set ONE contains the variables X,Y,Z and W. The following SAS program is submitted:
Proc transpose data =one Out=trans Name=new; By x; var y; run;
What are the names of all of the columns created by the TRANSPOSE procedure?
A. new, X, Y, and COL1
B. new, X, and COL1 only
C. new, Y, and COL1 only
D. new and X only
B. new, X, and COL1 only
The BY variables themselves aren’t transposed. The variables need to be sorted before running PROC TRANSPOSE. You can sort the variables with PROC SORT.
VAR - [Transpose Column] It lists the actual data that needs to be transposed. If you do not include a VAR statement, the procedure will transpose all numeric variables that are not included in a BY statement or a ID statement. If you want to transpose a character variable, a VAR statement is required.
Which SAS integrity constraint type ensures that a specific set or range of values are the only values in a variable?
A. check
B. unique
C. not null
D. primary key
A. check
The following SAS program is submitted:
%let test=one; %let one=two; %let two=three; %let three=last; %put what displays ; &&&&&test;
What is the written to the SAS log?
A. what displays is three
B. what displays is two
C. what displays is one
D. what displays is last
B. what displays is two
What is an advantage of using a hash object in a SAS DATA step?
A. The hash object key values can be multiple numeric and character data values
B. The hash object does not require unique keys
A. The hash object key values can be multiple numeric and character data values
What is generated as a result of submitting the RANUNI function with a seed of 123?
A. A consistent sequence of random numbers with each program execution.
B. A random number between 0 and 123.
A. A consistent sequence of random numbers with each program execution.
Which one of the following statements completes the above and resolves dept to
“For research&development”?
A. %let dept = %nrstr(For research&development);
B. %let dept = %str(For research&development);
A. %let dept = %nrstr(For research&development);
Explaination: %NRSTR also masks the following characters: &; %