SAS exam 1
Ods pdf text=
"Which command would you use to insert a title in the middle of a page between two tables created by ODS PDF? Ods pdftoc= Ods pdf text= Ods pdf title Title2"
One column is CHARACTER type and the others are NUMERIC type.
Based on the query shown below, which different SAS data types does the work.Discounts table have? One column is CHARACTER type, two are DATE type, and two are NUMERIC type. Three columns are CHARACTER type and the others are NUMERIC type. One column is CHARACTER type and the others are NUMERIC type. All columns are NUMERIC type. All columns are CHARACTER type.
12
Consider this PROC SQL query: The table sashelp.cars contains 428 rows, 38 unique values of Make (Manufacturer), 33 unique values of MPG_Highway, and 12 different values of Make that have an average MPG_Highway that is less than 25. How many rows of output will the query generate?
No. Because there is no GROUP BY clause, the HAVING clause treats the entire table as one group.
Delighted Airlines is analyzing data to find underutilized flights. The same flight schedule occurs every day. Each route and time during the day is given a unique flight number. The same flight number is used for that route/time combination every day. The table sasuser.intlflights contains a separate row for each occurrence of every flight number every day. The BOARDED column indicates the number of passengers who flew on that particular flight. You want to output only those flight numbers that are averaging fewer than 100 passengers per day. Does the following PROC SQL query produce the results that you want? proc sql; select flightnumber, avg(boarded) as AvgPassengers from sasuser.intlflights having avg(boarded) < 100 order by 1;
4 rows Name PPG Name PPG Art 12 Art 13 Bob 17 Bob 16 Cal 20 Cal 19 Don 6 Don 11
Given the PROC SQL query and tables shown below, which output is generated?
select a.* from list1 a, list2 b where a.fname=b.fname and a.zip=b.zip and a.lname<>b.lname; or select * from list1 except select * from list2;
Given the two tables List1 and List2 and the output generated, which of the SQL queries shown would generate this output?
Numeric field with the number of days since January 1, 1960
How is a SAS date value stored in a dataset? Character field with the number of days since January 1, 1960 Depends on the format that is applied to the date field Character field with the number of days since January 1, 1900 Numeric field with the number of days since January 1, 1900 Numeric field with the number of days since January 1, 1960
20
How many rows will be returned by the PROC SQL step below based on the tables shown? proc sql; select * from prog1, prog2; 20, 9, 4, 2, 0r 120
256
How many tables can you join together if your query statement does not use the keywords JOIN and ON?
LEVEL
If a field named JOB has the value EXEC PLANT MANAGER LEVEL II, what is the value returned by Scan(JOB,-2,' ')? Missing EXEC II PLANT LEVEL I MANAGER
A new table is created but no results are printed to the output destination
If you specify a CREATE TABLE statement in your PROC SQL step, A new table is created but no results are printed to the output destination A new table is created and results are printed to the output destination The SQL syntax is validated and the results written to the log but the step does not execute An empty table will always be created without any rows of data
The columns that are specified in a join condition in the WHERE clause must have the same data type.
In order for PROC SQL to perform an inner join: The tables being joined must have the same number of columns. The columns that are specified in a join condition in the WHERE clause must have the same name. The columns that are specified in a join condition in the WHERE clause must have the same data type. The tables must be sorted before they are joined.
All choices listed
In which of the following ways is a PROC SQL join different from a DATA step match-merge? A PROC SQL join does not require the data to be sorted first A PROC SQL join does not overlay common columns by default A PROC SQL join may produce printed output All choices listed
sum(Q1, Q2, Q3, Q4)
The columns Q1, Q2, Q3, and Q4 contain the quarterly donation amount when an employee made a donation in that quarter. Which expression may be used in the SQL query shown so that the total annual donations for each employee will be computed correctly even if the donation amount is missing from one or more quarters? Select all that apply. proc sql; select employee_id, ___________ 'Total Donations' from orion.employee_donations; sum(Q1, Q2, Q3, Q4) Q1 + Q2 + Q3 + Q4 sum(Q1-Q4)
Orion Terminated Employees Active Orion Employees
What will be printed at the top of the second table that is produced by the SQL procedure shown below?
Incorporate all of the choices listed on this question.
When working with PROC SQL views, it is best to: Create a table instead of a view to access the same data several times in a program. Avoid using an ORDER BY clause in a view. Avoid creating views that are based on tables whose structure might change. Incorporate all of the choices listed on this question.
Order by Product_Group, Price desc
Which Order By clause sorts a report by ascending Product_Group and descending Price? Order by Product_Group, desc Price Order by Product_Group, Price Order by asce Product_Group, desc Price Order by Product_Group, Price desc
proc sql; select coalesce(a.week,b.week) label='Week', Mfg, Sold from table1 as a full join table2 as b on a.week=b.week order by 1;
Which PROC SQL query will generate the same output as the DATA step match-merge and PRINT step shown below? data merged; merge table1 table2; by week; run; proc print data=merged noobs; run;
Proc sql; select * from gizmos union select * from widgets; Union keeps columns from 1st table and overlays data from 2nd table regardless of variable name, but no duplicates.
Which PROC SQL step combines the tables Gizmos and Widgets to produce the output displayed below?
Proc sql; select fname, lname from STAT657 outer union corr select fname, lname from STAT659 order by lname;
Which PROC SQL step will generate the same results as the following DATA step based on the two tables shown below? data allstudents; set STAT657 STAT659; by lname; drop grade; run; proc print data=allstudents noobs; run;
Proc sql; select fname, lname from STAT657 intersect all select fname, lname from STAT659;
Which PROC SQL step will return only the names of the two students who were enrolled in both STAT657 and STAT659 Classes based on the two class rosters shown below?
select distinct Employee_Gender, Job_Title... select unique Employee_Gender, Job_Title...
Which SELECT clauses select only the unique combinations of Employee_Gender and Job_Title? select distinct Employee_Gender, Job_Title... select distinct Employee_Gender Job_Title... select distinct Employee_Gender, distinct Job_Title... select unique Employee_Gender, Job_Title...
select department, case when avg_salary > co_avg_salary then 'High' else 'Low' end as COMPENSATION or select department, case avg_salary > co_avg_salary when 1 then 'High' else 'Low' end as COMPENSATION. Case resolves to true/false, so it creates 1/0 unless otherwise specified
Which SQL code will correctly use conditional logic to create a field called COMPENSATION? Select all that apply.
Proc sql; describe view orion.sales;
Which SQL code will write the definition of the orion.sales view to the SAS Log? Proc sql; describe view orion.sales; Proc sql; validate view orion.sales; Proc sql; describe table orion.sales; Proc sql; create view orion.sales; Proc sql; define view orion.sales;
select prog1.*, prog2.grade from sasuser.prog1 left join sasuser.prog2 on prog1.fname=prog2fname and prog1.lname=prog2.lname;
Which SQL select statement produces the output shown from the Prog 1 and Prog2 tables?
Statement B
Which SQL statement shown below will cause this message to be written to the SAS log?
All clauses are correct
Which clause in the following program is incorrect?
-3.1416
Which is an example of standard numeric data? 1/3 -3.1416 05/08/2012 20% $52,432.42
Proc sql; create table work.newpayroll like sasuser.payrollmaster;
Which of the following PROC SQL steps creates a new table by copying only the column structure (but not the rows) of an existing table?
Can return any number of rows, but must return only one column Can be used on a WHERE clause
Which of the following are true regarding a noncorrelated subquery? Select all that apply. Can return any number of rows, but must return only one column Is inefficient because it must be evaluated for every row of the main query Can be used on a WHERE clause Can return any number of rows and columns Can be used on a FROM clause
Can be used on a FROM clause Can return any number of rows and columns
Which of the following are true regarding an in-line view? Select all that apply. Can be used on a FROM clause Is inefficient because it must be evaluated for every row of the main query Can return any number of rows and columns Can return any number of rows, but must return only one column Can be used on a WHERE clause
Proc sql; create table work.names (FullName char(25), Age num);
Which of the following creates an empty table that contains the 2 columns FullName and Age?
Multiway join
Which of the following is not an outer join?
avg_gifts Average4 _4qtr_avg
Which of the following may be used as a valid SAS column name to complete the SQL query shown and create the SAS data set GIVING? Select all that apply. proc sql; create table GIVING as select employee_id, donations/4 as ___________ from orion.employee_donations; quarterly.avg avg_gifts Average4 'Quarterly Avg.' 4qtr_avg _4qtr_avg
The total salary paid to all active employees from the employee_payroll table
Which statement is true regarding the location of the table named CUSTOMER whenever you access the view created in the following query? The total salary paid to all active employees in each job title The total salary paid to all active employees from the employee_payroll table The total salary paid to all active employees in each department The total salary paid to all employees from the employee_payroll table
When a SELECT list contains both a column created by a summary function and a column that is not summarized, by default, the summarized data is appended to each row of the original data table. When PROC SQL remerges data, it displays a related message in the SAS log.
Which statement or statements are true about data remerging?
By using data remerging, PROC SQL can avoid making two passes through the data. PROC SQL does not attempt to remerge data unless a subquery is used. When PROC SQL remerges data, it combines data from two tables.
Which statements are not true about data remerging?
Both (A) and (B) will work
Which syntax will select employee IDs having bonuses less than $500? A. select Employee_ID, Salary*0.1 as Bonus from orion.Employee_Payroll where calculated Bonus < 500; Both (A) and (B) will work B. select Employee_ID, Salary*0.1 as Bonus from orion.Employee_Payroll having Bonus < 500; Neither (A) nor (B) will work
select distinct category, sum(sum(salary, bonus)) as EARNINGS
select distinct category, sum(sum(salary, bonus)) as EARNINGS select category, sum(salary + bonus) as EARNINGS select distinct category, sum(salary, bonus) as EARNINGS select category, sum(salary, bonus) as EARNINGS