





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 9
This page cannot be seen from the preview
Don't miss anything!






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=¯ovar;
-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
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,
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;