SAS Quiz(100% New And Real Time Questions)

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Pythonlearn20160
P
Pythonlearn20160
Community Contributor
Quizzes Created: 1 | Total Attempts: 464
Questions: 20 | Attempts: 464

SettingsSettingsSettings
SAS Quizzes & Trivia

Questions and Answers
  • 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? 

    • A.

      Delhi

    • B.

      Apparent symbol is not resolved

    • C.

      Mycity

    • D.

      9

    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.

    Rate this question:

  • 2. 

    Which of the following is a debugging technique in PROC SQL 

    • A.

      MLOGIC

    • B.

      FEEDBACK

    • C.

      MPRINT

    • D.

      VALIDATE

    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.

    Rate this question:

  • 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?

    • A.

      PROC SQL; CREATE TABLE THREE LIKE SELECT * FROM ONE OUTER UNION SELECT * FROM TWO; QUIT;

    • B.

      PROC SQL; CREATE TABLE THREE AS SELECT * FROM ONE OUTER UNION SELECT * FROM TWO; QUIT;

    • C.

      PROC SQL; VALIDATE CREATE TABLE THREE AS SELECT * FROM ONE OUTER UNION SELECT * FROM TWO; QUIT;

    • D.

      PROC SQL; CREATE TABLE THREE AS SELECT * FROM ONE OUTER UNION, SELECT * FROM TWO; QUIT;

    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.

    Rate this question:

  • 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 ?

    • A.

      True

    • B.

      False

    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.

    Rate this question:

  • 5. 

    Which of the following will create the output as shown in figure?

    • A.

      MLOGIC

    • B.

      SYSTEMOPTION

    • C.

      %PUT AUTOMATIC ;

    • D.

      %PUT _ALL_;

    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.

    Rate this question:

  • 6. 

    What does an FLOW OVER option do in an ODS Statement ?

    • 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

    • B.

      Stops the output pointer to a new line if a PUT statement attempts to write an item beyond the last ODS column in the buffer

    • C.

      Discards the output pointer to a new line if a PUT statement attempts to write an item beyond the last ODS column in the buffer

    • D.

      None of the above

    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.

    Rate this question:

  • 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.

    • A.

      Proc sql; Create unique index daily on work.CLASS (GENDER, CLASS) ;

    • B.

      Proc sql; New unique index daily on work.CLASS (GENDER, CLASS);

    • C.

      Proc sql; Create unique index GENDER, CLASS on work. CLASS (GENDER, CLASS);

    • D.

      Proc sql; Create PRIMARY index on work. CLASS (GENDER, 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.

    Rate this question:

  • 8. 

    Which of the following will direct SAS to ignore all indexes in the following procedure

    • A.

      Proc sql; Select * from sasuser.cars (idxwhere=no) where speed > 150 ; Quit;

    • B.

      Proc sql; Select * from sasuser.cars (idxwhere=ignore) where speed > 150; Quit;

    • C.

      Proc sql; Select * from new. Cars (idxwhere=point) where speed > 150; Quit;

    • D.

      Proc sql; Select * from new. Cars (idxwhere=yes) where speed > 150; Quit;

    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.

    Rate this question:

  • 9. 

    Which of the following macro variable resolves to Joan’s Report

    • A.

      %let text=%bquote(Joan's Report);

    • B.

      %let text=Joan%str(')s Report;

    • C.

      %let text=bquote(Joan's Report);

    • D.

      %let text=Joan%str(',)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.

    Rate this question:

  • 10. 

    %let summit= brics2016;Which one of the following statements stores the value brics in the macro variable summitname?

    • A.

      %let summitname= %substr(&summit,%length(&summit)-4);

    • B.

      %let summitname= %nrsubstr(summit,1,%length(&summit)-4);

    • C.

      %let summitname= %substr(&summit,1,%length(&summit)-4);

    • D.

      %let summitname= %substr(&summit,1,length (&summit)-4);

    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.

    Rate this question:

  • 11. 

       %let a= 10;   %let b= 9;   %let c= %sysevalf(&a/ &b);   %put &c; What is written to SAS Log ?

    • A.

      Macro variable C resolves to 1.11111

    • B.

      Macro variable C resolves to 1.12

    • C.

      Macro variable C resolves to 1

    • D.

      Macro variable C resolves to 10/9

    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.

    Rate this question:

  • 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

    • A.

      20

    • B.

      40

    • C.

      NULL/BLANK

    • D.

      Unable to determine/error

    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.

    Rate this question:

  • 13. 

    Which statement is false regarding the keyword CORRESPONDING? 

    • A.

      It cannot be used with the keyword ALL.

    • B.

      It overlays columns by name, not by position.

    • C.

      When used in EXCEPT, INTERSECT, and UNION set operations, it removes any columns not found in both tables.

    • D.

      When used in OUTER UNION set operations, it causes same-named columns to be overlaid.

    Correct Answer
    A. It cannot be used with the keyword ALL.
    Explanation
    The keyword CORRESPONDING can be used with the keyword ALL.

    Rate this question:

  • 14. 

    If you store a macro definition in a SAS catalog SOURCE entry 

    • A.

      You can use FILENAME and %INCLUDE statements for compiling the macro

    • B.

      You can use the PROC CATALOG statement to compile the macro

    • C.

      The SOURCE entry is deleted at the end of the session

    • D.

      You do not need to compile the macro before you invoke it in a program.

    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.

    Rate this question:

  • 15. 

    Which SQL procedure program deletes rows from the data set CLASS ?

    • A.

      Proc sql; delete from newdata.class Where age

    • B.

      Proc sql; delete from newdata.class age

    • C.

      Proc sql; delete from newdata.class Where age

    • D.

      Proc sql; delete from newdata.class Where age

    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.

    Rate this question:

  • 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;

    • A.

      40

    • B.

      50

    • C.

      60

    • D.

      70

    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.

    Rate this question:

  • 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?

    • A.

      Proc sql; select * from class1 union all select * from class2 where class1.rank=class2.rank; quit;

    • B.

      Proc sql; select * from class1 union all select * from class2 quit;

    • C.

      Proc sql; select * from class1,class2; quit;

    • D.

      Proc sql; select * from class1 union select * from class2 quit;

    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?

    • A.

      Proc sql; select * from class1 union select * from class2 order by exams; quit;

    • B.

      Proc sql; select * from class1 outer union select * from class2 on class1.exams=class2.exams quit;

    • C.

      Proc sql; select * from class1 left join select * from class2 on class1.exams=class2.exams; quit;

    • D.

      Proc sql; select * from class1 union all select * from class2 quit;

    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.

    Rate this question:

  • 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;

    • A.

      Data work.class; Set class1 class2 class3; Where id >5; Run;

    • B.

      Data work.class; Set class1 class2 class3; Where id ge 5; Run;

    • C.

      Data work.class; merge class1 class2 class3; Where id ge 5; Run;

    • D.

      Data work.class; merge class1 class2 class3; Where id > 5; 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.

    Rate this question:

  • 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;

    • A.

      New, R,S and _COL1_

    • B.

      New, P and COL1 only

    • C.

      _COL1_,_COL2_ AND _COL3_ ONLY

    • D.

      P,Q AND R ONLY

    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.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 20, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 07, 2016
    Quiz Created by
    Pythonlearn20160

Related Topics

Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.