SAS 9.4 Programming Fundamentals A00-215 Exam Questions

Page: 1 / 14
Total 78 questions
Question 1

Which SAS format displays a SAS date as 25JUN2019?



Answer : B

Option B is correct. The DATE9. format in SAS displays dates in the ddMMMyyyy format, which corresponds to the example given (25JUN2019). This format writes dates with a two-digit day, a three-character month abbreviation, and a four-digit year. The other options do not match the correct format:

A is incorrect because ddMMMyy9. format would display a two-digit year.

C is incorrect because there is no such format as Ddmmmyyyy9. in standard SAS formats.

D is incorrect because Dmy9. does not correspond to the required format.


SAS 9.4 documentation on date and time formats.

Question 2

Which program correctly subnets the SASHELP. BASEBALL data set to include only the players in the East Division with 75 or more hits?



Answer : D

To subset data in SAS using the data step, the where statement is used to specify the conditions that observations must meet to be included in the new data set. The correct syntax for subsetting the SASHELP.BASEBALL data set to include only players in the 'East' Division with 75 or more hits is as follows:

data bball;

set sashelp.baseball;

where Division = 'East' and nHits >= 75;

run;

This code, as shown in option D, uses the where statement with the correct logical operator and to ensure that both conditions must be true for a record to be included in the new dataset. Options A, B, and C either use incorrect syntax or logical operations that do not match the required conditions for the subset. Option A has an incorrect combination of conditions, B uses two where statements which is not valid syntax, and C incorrectly uses the or operator which would include players not in the 'East' Division or with fewer than 75 hits.


Question 3

Fill in Blank

Given the following DATA step:

What is the value of average?

The value of average is _____.

Enter your numeric answer in the space above.



Answer : A

In the DATA step provided, average is calculated using the mean function, which calculates the average of the non-missing values of the variables listed. The variables provided are:

var1 = 2

var2 = 4

var3 = .

var4 = 6

The mean function in SAS ignores missing values, represented by a period (.). Hence, the average is computed using the non-missing values (2, 4, and 6). The mean of these three numbers is calculated as: (2 + 4 + 6) / 3 = 12 / 3 = 4

Therefore, the value of average is 4.


SAS documentation on the MEAN function, SAS Institute.

Question 4

Which PROC PRINT statement controls the order of the variables displayed in the report?



Answer : C

In PROC PRINT, the VAR statement is used to control the order of the variables displayed in the report. You can list the variables in the order you want them to appear. The KEEP statement can control which variables appear, but not their order. DROP and SELECT are not valid statements within PROC PRINT for controlling the order of variables.

Reference

SAS documentation for PROC PRINT.


Question 5

Given the input data set WORK. GR_ANS with two character variables:

The following SAS program is submitted:

Which report is created?

A)

B)

D)



Answer : D

The SAS program provided includes a PROC FORMAT step that defines a numeric format called Syn and applies this format to the variable answer in the PROC PRINT step. The format maps the value '0' to 'No', '1' to 'Yes', and all other values to 'Unknown'.

However, there is a syntax error in the PROC FORMAT step: it uses a dollar sign before Syn, which is used to indicate character formats, but the format is defined for numeric values (0 and 1). Therefore, when applying this format to the answer variable in PROC PRINT, it should not have a dollar sign, it should be format answer Syn.; instead of format answer $yn.;.

The correct output based on the given code, assuming the error with the dollar sign is corrected, would be as follows:

For numeric values 0 and 1, 'No' and 'Yes' would be displayed, respectively.

For any other numeric value, 'Unknown' would be displayed.

For character values, the format would not apply and the actual values would be displayed.

Given that the values in the 'answer' column are numeric, the program will format them according to the defined Syn format. Thus, the report corresponding to Option D, which shows numeric values unformatted, would be the one created. This indicates that the format was not applied because of the syntax error with the dollar sign.


SAS 9.4 documentation for the FORMAT procedure and statement: SAS Help Center: PROC FORMAT

Question 6

Which PROC MEANS statement specifies the numeric variables to analyze?



Answer : D

The VAR statement in PROC MEANS is used to specify the variables for which you want to calculate the descriptive statistics such as the mean and standard deviation. You list the names of one or more numeric variables after the VAR statement to include them in the analysis. Therefore, option D is the correct answer.

Reference

SAS documentation for PROC MEANS.


Question 7

The sashelp. class data set has 19 observations.

Given the frequency information about the Age, shown below:

How many observations are written to output data set when the following code is submitted?



Answer : B

The code creates two datasets, preteen and teen, based on the age variable from the sashelp.class dataset. The if statement checks each observation, and if the age is less than 13, the observation is written to the preteen dataset; otherwise, the observation is written to the teen dataset.

From the provided frequency table, we can see that there are 7 observations with ages less than 13 (2 for age 11 and 5 for age 12), so the preteen dataset will have 7 observations. Since the sashelp.class dataset has a total of 19 observations, the remaining 12 observations (19 total - 7 preteen = 12 teen) will be written to the teen dataset.

Thus, the answer is: B. preteen will have 7 observations and teen will have 12 observations.


SAS documentation on the DATA step and IF-THEN/ELSE logic, SAS Institute.

Page:    1 / 14   
Total 78 questions