SAS Base Exam (Programming 2) Questions With Complete Solutions
Which of the following is not created during the compilation phase? - the data set descriptor portion - the first observation - the program data vector - the _N_ and _ERROR_ automatic variables correct answer: the first observation ** No data is read during the compilation phase. The first observation is created in the execution phase ** During the compilation phase, SAS scans each statement in the DATA step, looking for syntax errors. Which of the following is not considered a syntax error? correct answer: incorrect data values ** Data values are not read during the compilation phase and do not generate syntax errors ** Unless otherwise directed, how many times does the DATA step loop execute? - once for each compilation phase - once for each DATA step statement - once for each row in the input file - once for each column in the input file correct answer: once for each row in the input file ** By default, the DATA step executes once for each row in the input file. It reads a row, processes the values in that row, and writes the row to an output table ** At the beginning of the execution phase, the value of _N_ is 1, the value of _ERROR_ is 0, and the values of the remaining variables are set to which of the following? - 0 - 1 - undefined - missing correct answer: missing ** The values of the remaining columns are assigned a missing value. Character columns are assigned a blank, and numeric columns are assigned a period. ** Suppose you run a program that causes three data errors. What is the value of the automatic variable _ERROR_ when the row that contains the third error is processed? - 0 - 1 - 2 - 3 correct answer: 1 ** _ERROR_ is 1 for any row that contains a data error ** Consider the following DATA step. Based on the sample input file below, in what order are the variables stored in the new fin2 table? data fin2; set finance; keep Name Raise NewSalary Date; if Salary>25000 then Raise=0.03; else Raise=0.05; NewSalary=(Salary*Raise)+Salary; run; - Name, Raise, NewSalary, Date - SSN, Name, Salary, Date, Raise, NewSalary - Name, Date, Raise, NewSalary - Salary, NewSalary, Name, Raise correct answer: Name, Date, Raise, NewSalary ** The order of the columns in the PDV is determined by the order of the statements in the DATA step. The SET statement first adds the columns from the input table into the PDV, and then the assignment statements add Raise and NewSalary to the PDV. Only Name, Date, Raise, and NewSalary are kept in the output table ** Which of the following actions occurs at the beginning of an iteration of the DATA step? - The automatic variables _N_ and _ERROR_ are incremented by 1. - The DATA step stops execution. - The descriptor portion of the data set is written. - The values of variables created in programming statements are reset to missing in the program data vector. correct answer: The values of variables created in programming statements are reset to missing in the program data vector ** Any new columns created with programming statements are reset to missing at the beginning of each DATA step iteration ** If the input table contains five columns, which PUTLOG statements create the following results in the SAS log? - putlog "NOTE: Begin DATA Step"; putlog _all_; - putlog NOTE="Begin DATA Step"; putlog _all_; - putlog "NOTE: Begin DATA Step"; putlog Name Sex Age Height Weight _ERROR_ _N_; - putlog NOTE(Begin DATA Step); putlog all; correct answer: putlog "NOTE: Begin DATA Step"; putlog _all_;
Written for
- Institution
- SAS
- Course
- SAS
Document information
- Uploaded on
- September 25, 2023
- Number of pages
- 36
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
- programming 2
- sas base exam
-
sas base exam programming 2 questions with compl
-
which of the following is not created during the c