SAS Data Analytics: Questions and Solutions, Exams of Nursing

A collection of sas data analytics questions along with their complete solutions. It covers topics such as proc print, proc means, proc univariate, proc freq, filtering rows with where statements, formatting columns, sorting data, removing duplicates, and computing new columns. It also includes conditional processing and examples of macro variables. This resource is designed to help students and professionals enhance their understanding and skills in sas data analytics.

Typology: Exams

2024/2025

Available from 12/01/2025

whitegiraffe69485
whitegiraffe69485 ๐Ÿ‡ฌ๐Ÿ‡ง

6.3K documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
SAS Data Analytics questions with
complete solutions
PROC PRINT - correct answer โœ”โœ” lists all columns and rows in the input table
by default. The OBS= data set option limits the number of rows listed. The
VAR statement limits and orders the columns listed.
PROC PRINT DATA=input-table(OBS=n); VAR col-name(s);RUN;
PROC MEANS - correct answer โœ”โœ” generates simple summary statistics for
each numeric column in the input data by default. The VAR statement limits
the variables to analyze.
PROC MEANS DATA=input-table; VAR col-name(s);RUN;
PROC UNIVARIATE - correct answer โœ”โœ” also generates summary statistics for
each numeric column in the data by default, but includes more detailed
statistics related to distribution and extreme values. The VAR statement
limits the variables to analyze.
PROC UNIVARIATE DATA=input-table; VAR col-name(s);RUN;
PROC FREQ - correct answer โœ”โœ” creates a frequency table for each variable
in the input table by default. You can limit the variables analyzed by using
the TABLES statement.
PROC FREQ DATA=input-table; TABLES col-name(s) < / options>;RUN;
Filtering Rows - correct answer โœ”โœ” -The WHERE statement is used to filter
rows. If the expression is true, rows are read. If the expression is false, they
are not.
-Character values are case sensitive and must be in quotation marks.
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download SAS Data Analytics: Questions and Solutions and more Exams Nursing in PDF only on Docsity!

SAS Data Analytics questions with

complete solutions

PROC PRINT - correct answer โœ”โœ” lists all columns and rows in the input table by default. The OBS= data set option limits the number of rows listed. The VAR statement limits and orders the columns listed. PROC PRINT DATA=input-table(OBS=n); VAR col-name(s);RUN; PROC MEANS - correct answer โœ”โœ” generates simple summary statistics for each numeric column in the input data by default. The VAR statement limits the variables to analyze. PROC MEANS DATA=input-table; VAR col-name(s);RUN; PROC UNIVARIATE - correct answer โœ”โœ” also generates summary statistics for each numeric column in the data by default, but includes more detailed statistics related to distribution and extreme values. The VAR statement limits the variables to analyze. PROC UNIVARIATE DATA=input-table; VAR col-name(s);RUN; PROC FREQ - correct answer โœ”โœ” creates a frequency table for each variable in the input table by default. You can limit the variables analyzed by using the TABLES statement. PROC FREQ DATA=input-table; TABLES col-name(s) < / options>;RUN; Filtering Rows - correct answer โœ”โœ” -The WHERE statement is used to filter rows. If the expression is true, rows are read. If the expression is false, they are not. -Character values are case sensitive and must be in quotation marks.

-Numeric values are not in quotation marks and must only include digits, decimal points, and negative signs. -Compound conditions can be created with AND or OR. -The logic of an operator can be reversed with the NOT keyword. -When an expression includes a fixed date value, use the SAS date constant syntax: "ddmmmyyyy"d, where dd represents a 1- or 2-digit day, mmm represents a 3-letter month in any case, and yyyy represents a 2- or 4-digit year. WHERE Operators - correct answer โœ”โœ” PROC procedure-name ... ;WHERE expression;RUN; = or EQ,^= or ~= or NE,> or GT,< or LT,>= or GE,<= or LE SAS Date Constant - correct answer โœ”โœ” "ddMONyyyy" IN Operator - correct answer โœ”โœ” WHERE col-name IN(value-1<...,value- n>);WHERE col-name NOT IN (value-1<...,value-n>); Special WHERE Operators - correct answer โœ”โœ” WHERE col-name IS MISSING; WHERE col-name IS NOT MISSING; WHERE col-name IS NULL; WHERE col-name BETWEEN value-1 AND value-2;WHERE col-name LIKE "value"; WHERE col-name =* "value"; Filtering Rows with Macro Variables - correct answer โœ”โœ” %LET macro- variable=value; Example WHERE Statements with Macro Variables: - correct answer โœ”โœ” WHERE numvar=&macrovar;

-The DUPOUT= option creates an output table containing duplicates removed. -Using ALL in the BY statement sorts by all columns and ensures that duplicate rows are adjacent in the sorted table and are removed. -The NODUPKEY option keeps only the first row for each unique value of the column(s) listed in the BY statement. PROC SORT DATA=input-table <OUT=output-table>NODUPRECS <DUPOUT=output-table>;BY ALL;RUN; PROC SORT DATA=input-table <OUT=output-table>NODUPKEY <DUPOUT=output-table>;BY col-name(s);RUN; proc sort data=payment dupout=dups nodupkey; by ID; run; - correct answer โœ”โœ” The NODUPKEY option keeps the first row for each unique value of ID, format Order_Date date7. Delivery_Date mmddyy8.; - correct answer โœ”โœ” The DATE7. format displays a two-digit day, three-letter month abbreviation, and two-digit year. The MMDDYY8. format displays a two-digit month, day, and year, separated by slashes. the format name must include a period delimiter in the FORMAT statement. - correct answer โœ”โœ” The period is a required syntax element in a format name within a FORMAT statement. where Job_Title like "Sales%"; - correct answer โœ”โœ” This WHERE statement returns rows that contain Sales with any number of additional characters after Sales because of the position of the percent sign. proc sort data=orion.staff; out=work.staff; by descending Salary Manager_ID; run; - correct answer โœ”โœ” This PROC SORT step has a syntax error: a semicolon in the middle of the PROC SORT statement. If you correct this

syntax error, this step sorts orion.staff by Salary in descending order and by Manager_ID in ascending order. The step then creates the temporary data set staff that contains the sorted rows and all columns.

. where Style in (RANCH, SPLIT, TWOSTORY); - correct answer โœ”โœ” In the WHERE statement, the IN operator enables you to select rows based on several values. You specify values in parentheses and separate them with spaces or commas. Character values must be enclosed in quotation marks and must be in the same case as in the data set. where amount <= 5000 or rate=0.095; b. where amount le 5000 or rate=0.095; c. where amount <= 5000 or rate eq 0.095; d. all of the above - correct answer โœ”โœ” All of the statements shown here select rows in which Amount is less than or equal to $5000 or Rate equals 0.095. %let flower=Plumeria; - correct answer โœ”โœ” In the %LET statement, the name of the macro variable is followed by an equal sign and the unquoted value. The ampersand is added when you use the macro variable. Which statement in a PROC MEANS step lets you specify the numeric columns to analyze? - correct answer โœ”โœ” You use the VAR statement to specify the numeric columns to analyze in PROC MEANS. If you don't specify the VAR statement, all numeric columns are analyze You want to see the distinct values of Flower_Type with a count and percentage for each. Which procedure would you use? - correct answer โœ”โœ” PROC FREQ output includes the distinct values for the column, as well as a frequency count, percent, cumulative frequency, and cumulative percent. Reading and Filtering Data - correct answer โœ”โœ” Creating a copy of data: DATA output-table; SET input-table;

LENGTH char-column $ length; -Using functions in expressions: function(argument1, argument 2, ...); DATA output-table; SET input-table;new-column=function(arguments); RUN; Computing New Columns Part 2 - correct answer โœ”โœ” -Functions for calculating summary statistics (ignore missing values):SUM(num1, num2, ...)calculates the sumMEAN(num1, num2, ...)calculates the meanMEDIAN(num1, num2, ...)calculates the medianRANGE(num1, num2, ...)calculates the rangeMIN(num1, num2, ...)calculates the minimumMAX(num1, num2, ...)calculates the maximumN(num1, num2, ...)calculates the nonmissingNMISS(num1, num2, ...)calculates the missing -Character functions:UPCASE(char1)LOWCASE(char1)changes letters in a character string to uppercase or lowercasePROPCASE(char1)changes the first letter of each word to uppercase and other letters to lowercaseCATS(char1, char2, ...)concatenates character strings and removes leading and trailing blanks from each argumentSUBSTR(char, position, )returns a substring from a character string -Date functions that extract information from SAS date values:MONTH(sas- date-value)returns a number from 1 through 12 that represents the monthYEAR(sas-date-value)returns the four-digit yearDAY(sas-date- value)returns a number from 1 through 31 that represents the day of the monthWEEKDAY(sas-date-value)returns a number from 1 through 7 that represents the day of the week (Sunday=1)QTR(sas-date-value)returns a number from 1 through 4 that represents the quarter -Date functions that create SAS date values:TODAY()returns the current date as a numeric SAS date valueMDY(month, day, year)returns SAS date value from month, day, and year valuesYRDIF(startdate, enddate, 'AGE')calculates a precise age between two dates. There are various values for the third argument. However, "AGE" should be used for accuracy.

Conditional Processing - correct answer โœ”โœ” -Conditional processing with IF- THEN logic:IF expression THEN statement; -Conditional processing with IF-THEN-ELSE:IF expression THEN statement;<ELSE IF expression THEN statement;><ELSE IF expression THEN statement;>ELSE statement; -Processing multiple statements with IF-THEN-DO:IF expression THEN DO;END;<ELSE IF expression THEN DO;END;ELSE DO;END; -After the IF-THEN-DO statement, list any number of executable statements. -Close each DO block with an END statement. In which phase does the DATA step check for syntax errors? - correct answer โœ”โœ” Checking for syntax errors is the first step in the compilation phase which statement is used to read a SAS data set in a DATA step? - correct answer โœ”โœ” The SET statement indicates the table that will be read. The DATA statement indicates the table that will be created or updated. To process an Excel file with the DATA step, you must first create a copy of the data as a SAS table. True or False? - correct answer โœ”โœ” You can use the XLSX LIBNAME engine to read an Excel worksheet directly and process the data with the DATA step. What data statement is the output table in? - correct answer โœ”โœ” The output table is listed in the DATA statement. The data set orion.sales contains nine columns. Given this DATA step, how many columns does work.comp have? data work.comp; set orion.sales; keep employee_id gender job_title salary; run; - correct answer โœ”โœ” Only the four columns listed in the KEEP statement are written to the work.comp table.