1.
The following SAS program is submitted.%let city=delhi;%let no=9;%let mycity=no;%let country=mycity;%put &&&&&&&country;What is written to the SAS log?
Correct Answer
D. 9
Explanation
The SAS program defines macro variables using the %let statement. The macro variable "city" is assigned the value "delhi", the macro variable "no" is assigned the value "9", the macro variable "mycity" is assigned the value "no", and the macro variable "country" is assigned the value "mycity". The %put statement is used to write the value of the macro variable "&country" to the SAS log. Since "&country" resolves to "mycity", the value "9" is written to the SAS log.
2.
Which of the following is a debugging technique in PROC SQL
Correct Answer(s)
B. FEEDBACK
D. VALIDATE
Explanation
FEEDBACK is a debugging technique in PROC SQL that provides information about the execution of the SQL statements. It displays messages in the SAS log, allowing the programmer to identify and correct any errors or issues in the SQL code. VALIDATE is another debugging technique in PROC SQL that checks the syntax and semantics of the SQL statements without actually executing them. It helps in identifying any errors or inconsistencies in the code before running the SQL queries.
3.
Below two datasets ONE and TWO are submitted.DATA ONE;INPUT EMPID EMP_NAME$;DATALINES;10 JACK20 JONE30 GILT39 HENRY55 ROCK;RUN;DATA TWO;INPUT EMPD EMP_NAME$;DATALINES;10 HENRY34 NOSY55 JOHN24 REMO;RUN;which of the following will the create output dataset THREE?
Correct Answer
B. PROC SQL;
CREATE TABLE THREE AS
SELECT * FROM ONE OUTER UNION SELECT * FROM TWO;
QUIT;
Explanation
The correct answer is "PROC SQL; CREATE TABLE THREE AS SELECT * FROM ONE OUTER UNION SELECT * FROM TWO; QUIT;". This code will create an output dataset named THREE using the SQL procedure. It will combine the datasets ONE and TWO using the OUTER UNION operator, which will include all rows from both datasets, including any duplicates. The SELECT * statement is used to select all columns from both datasets, and the resulting dataset will contain all the columns from both datasets.
4.
PRIMARY KEY is the type of integrity constraint you would place on the variable StoreID to ensure that there are no missing values and that there are no duplicate values ?
Correct Answer
A. True
Explanation
The primary key is a type of integrity constraint that ensures the uniqueness and non-nullability of a column. By applying the primary key constraint on the variable StoreID, it guarantees that there are no missing values (non-nullability) and no duplicate values (uniqueness). This constraint is commonly used to uniquely identify each row in a table and enforce data integrity. Therefore, the given answer of "True" is correct.
5.
Which of the following will create the output as shown in figure?
Correct Answer
D. %PUT _ALL_;
Explanation
The correct answer is "%PUT _ALL_;" because the "%PUT _ALL_;" statement is used to display all the automatic macro variables and their values in the SAS log. In this case, it will display the value of the macro variable AUTOMATIC.
6.
What does an FLOW OVER option do in an ODS Statement ?
Correct Answer
A. Moves the output pointer to a new line if a PUT statement attempts to write an item beyond the last ODS column in the buffer
Explanation
The FLOW OVER option in an ODS Statement moves the output pointer to a new line if a PUT statement attempts to write an item beyond the last ODS column in the buffer. This means that if the output exceeds the available space in the current line, it will automatically wrap to the next line, ensuring that the output is properly displayed without any truncation or loss of data.
7.
Suppose we have a dataset named CLASS with four variables NAME, GENDER, SEX and CLASS. Which of the following will create an index on GENDER and CLASS.
Correct Answer
A. Proc sql;
Create unique index daily on work.CLASS (GENDER, CLASS) ;
Explanation
The correct answer is "Proc sql; Create unique index daily on work.CLASS (GENDER, CLASS) ;". This statement creates a unique index named "daily" on the dataset "CLASS" in the "work" library, with the index key variables as "GENDER" and "CLASS". This means that the index will be created based on the values of these two variables, allowing for faster data retrieval and improved performance when querying the dataset based on these variables.
8.
Which of the following will direct SAS to ignore all indexes in the following procedure
Correct Answer
A. Proc sql;
Select * from sasuser.cars (idxwhere=no) where speed > 150 ;
Quit;
Explanation
The correct answer is "proc sql; Select * from sasuser.cars (idxwhere=no) where speed > 150 ; Quit;". This is because the "idxwhere=no" option in the PROC SQL statement tells SAS to ignore all indexes when executing the query.
9.
Which of the following macro variable resolves to Joan’s Report
Correct Answer
A. %let text=%bquote(Joan's Report);
Explanation
The correct answer is "%let text=%bquote(Joan's Report);" because the %bquote function is used to mask special characters in a macro variable value. In this case, the single quote in "Joan's Report" is masked using %bquote, so the macro variable resolves to "Joan's Report" without any syntax errors.
10.
%let summit= brics2016;Which one of the following statements stores the value brics in the macro variable summitname?
Correct Answer
C. %let summitname= %substr(&summit,1,%length(&summit)-4);
Explanation
The correct answer is %let summitname= %substr(&summit,1,%length(&summit)-4). This statement uses the %substr function to extract a substring from the macro variable summit. It starts at the first character and goes up to the length of the variable minus 4, effectively removing the last 4 characters from the value of summit. The resulting substring is then stored in the macro variable summitname.
11.
%let a= 10; %let b= 9; %let c= %sysevalf(&a/ &b); %put &c; What is written to SAS Log ?
Correct Answer
A. Macro variable C resolves to 1.11111
Explanation
The macro variable C resolves to 1.11111 because the %sysevalf function is used to perform a floating-point division of the values of macro variables a and b. The result of the division is 1.11111, which is then assigned to the macro variable C. This value is then printed to the SAS Log using the %put statement.
12.
The following SAS program is submitted.data match; array balls{4,2}_temporary_ (10,20,30,40,50,60,70); runs= balls{4,2}; run;Which one of the following is the value of the variable runs in the data set match
Correct Answer
C. NULL/BLANK
Explanation
The variable "runs" is assigned the value of the element in the array "balls" with indexes 4 and 2, which is NULL/BLANK.
13.
Which statement is false regarding the keyword CORRESPONDING?
Correct Answer
A. It cannot be used with the keyword ALL.
Explanation
The keyword CORRESPONDING can be used with the keyword ALL.
14.
If you store a macro definition in a SAS catalog SOURCE entry
Correct Answer
A. You can use FILENAME and %INCLUDE statements for compiling the macro
Explanation
Storing a macro definition in a SAS catalog SOURCE entry allows you to use FILENAME and %INCLUDE statements for compiling the macro. This means that you can include the macro definition in your program using the %INCLUDE statement, and the macro will be compiled and available for use. The FILENAME statement is used to specify the location of the macro definition in the SAS catalog. This allows for easy access and compilation of the macro without the need to manually compile it before invoking it in a program.
15.
Which SQL procedure program deletes rows from the data set CLASS ?
Correct Answer
A. Proc sql;
delete from newdata.class
Where age
Explanation
The correct answer is "proc sql; delete from newdata.class Where age". This SQL procedure program uses the "delete" statement to remove rows from the data set "CLASS" where the condition "age" is met.
16.
Given the following program, What is the point value of “henry” in the dataset two ?data two;array score{2,4} _temporary_(40,50,60,70,40,50,60,70);set work.one;Points=score{hour,rating};run;
Correct Answer
C. 60
Explanation
The program is creating an array called "score" with dimensions 2x4 and initializing it with values 40, 50, 60, and 70. Then, it is using the "set" statement to read data from a dataset called "work.one". Finally, it is assigning the value of "score{hour,rating}" to the variable "Points". Since the array "score" has 2 rows and 4 columns, the expression "score{hour,rating}" is accessing the value at the intersection of the "hour" row and the "rating" column, which is 60.
17.
Given two sas datasets class1 and class2;data class1;input name$ rank exams;datalines;Alice 4 1Carol 2 1Henry 3 1James 1 2Janet 2 2louis 3 2leani 4 2;run;data class2;input name$ rank exams;datalines;Barbara 1 1Jeffrey 5 1William 5 2;run;which of the following will produce the given output?
Correct Answer
C. Proc sql;
select * from class1,class2;
quit;
18.
Given two sas datasets class1 and class2;data class1;input name$ rank exams;datalines;Alice 4 1Carol 2 1Henry 3 1James 1 2Janet 2 2louis 3 2leani 4 2;run;data class2;input name$ rank exams;datalines;Barbara 1 1Jeffrey 5 1William 5 2;run;which of the following will produce the given output?
Correct Answer
A. Proc sql;
select * from class1 union select * from class2
order by exams;
quit;
Explanation
The correct answer is "proc sql; select * from class1 union select * from class2 order by exams; quit;". This query combines the data from both class1 and class2 datasets using the UNION operator and sorts the result by the exams column. The UNION operator eliminates duplicate rows from the result set.
19.
Given the following datasets class1,class2 and class3data class1;input name$ id bus_no fee_status$;datalines;Alice 9 1 YCarol 8 1 Y;run;data class2;input name$ id bus_no fee_status$;datalines;Barbara 1 1 YJeffrey 5 2 N;run;data class3;input name$ id bus_no fee_status$;datalines;Judy 4 2 NMary 3 2 Y;run;
Correct Answer
A. Data work.class;
Set class1 class2 class3;
Where id >5;
Run;
Explanation
The correct answer is "Data work.class; Set class1 class2 class3; Where id >5; Run;". This is the correct answer because it uses the SET statement to combine the datasets class1, class2, and class3 into a single dataset called work.class. The WHERE statement is then used to filter the observations, only selecting those where the id variable is greater than 5. Finally, the RUN statement is used to execute the data step and create the new dataset.
20.
The SAS data set ONE contains the variables P,Q,R and S.The following SAS program is submitted:Proc transpose data =oneOut=transName=new;By P;var Q;run;
Correct Answer
B. New, P and COL1 only
Explanation
The SAS program is using the PROC TRANSPOSE statement to restructure the data set ONE. The BY statement is used to group the observations by the variable P. The VAR statement specifies that only variable Q should be transposed. The resulting transposed data set, named new, will contain the variables P and COL1 only.