1.
A raw data file is listed below.
1---+----10---+----20---+---
ran andhy 01/31/89
andriya carlos 12-25-87
samson antony 01/17/51
The following program is submitted using above file as input:
data work.family;
infile 'file-specification';
run;
Correct Answer
B. Input lastname $ first_name $ birthdate : mmddyy8.;
Explanation
The correct answer is "input lastname $ first_name $ birthdate : mmddyy8.". This answer is correct because it specifies the correct format for reading the birthdate variable from the raw data file. The mmddyy8. format indicates that the birthdate should be read as a date in the format month-day-year with 8 characters.
2.
Data scores;
infile datalines;
input Name $ scr1 scr2 scr3 scr4 scr5 scr6;
datalines;
steven 30 40 60 80
sabastian 40 30 25 45 71 85
robert 20 60 10
;
run;
Desired output
Name scr1 scr2 scr3 scr4 scr5 scr6
Steven 30 40 60 80 . .
Sabastian 40 30 25 45 75 85
Robert 20 60 10
What option we need to use in order to get desired outcome
Correct Answer
A. MISSOVER
Explanation
The option that needs to be used in order to get the desired outcome is MISSOVER. This option is used to prevent the INPUT statement from reading past the end of a record when there are fewer variables in the INPUT statement than there are columns in the data line. It allows the program to continue reading subsequent records without stopping or generating an error.
3.
The following is an example of.... (Choose one)
data employee;
infile 'employee.dat'; /* Assuming directory-based system */
input id $6. name $20. @30 locale $10.;
run;
Correct Answer
A. List
Explanation
The code snippet provided is an example of a list input style in SAS programming. In this style, the input data is read in a single line and the values are assigned to variables based on their position in the input line. The "@" symbol is used to specify the column position for each variable. Therefore, the correct answer is "List".
4.
filename statement can be used to access external file
Correct Answer
A. True
Explanation
The filename statement can indeed be used to access an external file. This statement allows a program to specify the name of a file that it wants to open or access for reading or writing data. By using the filename statement, the program can establish a connection or link to the external file and perform various operations on it, such as reading data from the file or writing data to it. Therefore, the statement is true.
5.
Default delimiter for list input is
Correct Answer
blank
Explanation
The default delimiter for list input is blank. This means that when inputting a list, the elements are separated by a blank space.
6.
Using dsd option in infile statement changes default delimiter to comma
Correct Answer
A. True
Explanation
The dsd option in the infile statement is used to specify that the data being read in has delimited fields and may contain special characters like commas within the data. By default, the delimiter is a space, but using the dsd option changes the default delimiter to a comma. Therefore, the given statement is true.
7.
Following delimiter will be used to access ASCII files
Correct Answer
A. Dlm='09'x
Explanation
The correct answer is dlm='09'x. This is because '09'x is the hexadecimal representation of the ASCII code for the horizontal tab character. In ASCII files, the horizontal tab character is often used as a delimiter to separate fields or columns of data. Therefore, specifying dlm='09'x means that the delimiter used to access the ASCII files is the horizontal tab character.
8.
Following statement will be used to place data directly into sas program
Correct Answer
B. Datalines
Explanation
The "datalines" statement is used in SAS to directly input data into a program. It is followed by the actual data values that need to be entered. This statement is useful when there is a small amount of data that needs to be inputted quickly and easily. It eliminates the need for creating a separate data file and importing it into the program. Instead, the data can be directly entered after the "datalines" statement.
9.
Which input method is more appropriate to import data with following description
Variable Description Starting Ending DataType
Column Column
Subj Subject Number 1 3 Character
DOB Date of Birth 4 13 Character
Gender Gender 14 14 Character
Balance Bank Account 15 21 Numeric
Balance
Correct Answer
A. Column
Explanation
Based on the given description, the most appropriate input method to import the data would be to use the "column" input method. This is because the data is organized into columns with specific starting and ending points, and each column has a specified data type. Using the "column" input method would allow for the data to be imported accurately and correctly aligned with the corresponding variables.
10.
In following code is example of
data grade;
infile 'c:\grading.txt';
input student_id $ 1-3 DOB $ 4-13 Gender $ 14 Score 15-21;
run;
Correct Answer
C. Column input
Explanation
The given code is an example of column input. This is because the input statement specifies the exact column positions of each variable in the input data file. The dollar sign ($) is used to indicate that the variable is a character variable, and the hyphen (-) is used to specify a range of columns. The input statement reads the data from the file based on the specified column positions.
11.
For numeric variables SAS uses _____ bytes to store values
Correct Answer
8
Explanation
For numeric variables, SAS uses 8 bytes to store values. This means that SAS allocates 8 bytes of memory to store each numeric value in a dataset. This allows SAS to store a wide range of numeric values, including integers and decimals, with precision and accuracy. Using 8 bytes for numeric variables also ensures that SAS can handle large numbers and perform calculations without losing precision.
12.
Informat is required to import date and time values into SAS
Correct Answer
A. True
Explanation
The statement is true because the informat is a SAS statement that is used to read data into SAS and convert it into a specific format. In this case, the informat is required to import date and time values into SAS, allowing the program to recognize and interpret these values correctly. Without the informat, SAS may not be able to properly handle date and time data, leading to errors or incorrect analysis. Therefore, it is necessary to use the informat statement when importing date and time values into SAS.
13.
SAS stores dates into numaric values
Correct Answer
A. True
Explanation
SAS stores dates as numeric values because it uses a specific format called "SAS date value" to represent dates. In this format, each date is assigned a unique numeric value, which represents the number of days since January 1, 1960. This numeric representation allows SAS to perform calculations and comparisons on dates more easily. By storing dates as numeric values, SAS can also handle a wide range of date-related operations, such as calculating time intervals, sorting dates, and performing date arithmetic.
14.
SAS uses following date for date calculations
Correct Answer
A. January 1, 1960
Explanation
SAS uses January 1, 1960 as the reference date for date calculations. This means that when performing calculations or comparisons involving dates in SAS, the dates are measured relative to January 1, 1960. This reference date allows for consistent and standardized date calculations within SAS programming.
15.
SAS date value for December 1, 1959
Correct Answer
A. -31
Explanation
The SAS date value for December 1, 1959 is -31. In SAS, dates are represented as the number of days since January 1, 1960, with negative values for dates before that. Since December 1, 1959 is before January 1, 1960, the date value is negative. The specific value of -31 represents that it is 31 days before January 1, 1960.
16.
Following are example of standard numeric data (select all correct choices)
Correct Answer(s)
A. -1.54E-3
B. 1.54E3
C. 0.5
D. 10
E. -10
Explanation
The given options are all examples of standard numeric data. They include both positive and negative numbers, as well as decimal numbers and numbers expressed in scientific notation. The options also include a number expressed in currency format.
17.
Following are informat modifers in sas (select all correct choices)
Correct Answer(s)
A. :
D. &
Explanation
In SAS, the colon (:) is used as an informat modifier to read character variables with mixed data types. It allows SAS to read the data until it encounters a delimiter or a specified number of characters. The ampersand (&) is also an informat modifier used to read character variables with mixed data types. It tells SAS to stop reading the variable when it encounters a non-blank character. The dollar sign ($) is not an informat modifier but is used to define character variables in SAS. The hash symbol (#) is not an informat modifier in SAS.
18.
A SAS time value is stored as the number of seconds since midnight
Correct Answer
A. True
Explanation
A SAS time value is stored as the number of seconds since midnight. This means that the time value represents the elapsed time in seconds from midnight to a specific time. Storing time values in this format allows for easy calculations and comparisons between different time values. For example, if a SAS time value is 3600, it represents 1 hour since midnight. Therefore, the statement "A SAS time value is stored as the number of seconds since midnight" is true.
19.
Following are true for YEARCUTOFF option in SAS (select all correct choices)
Correct Answer(s)
A. Not applicable to four digit year values
B. This is system option
C. Default is 1920
Explanation
The YEARCUTOFF option in SAS is a system option that determines the cutoff year for interpreting two-digit year values. It is not applicable to four-digit year values as they are already complete and do not require interpretation. The default value for YEARCUTOFF is 1920, meaning that any two-digit year value less than or equal to 20 will be interpreted as belonging to the 21st century (2000s), while any two-digit year value greater than 20 will be interpreted as belonging to the 20th century (1900s).
20.
If default YEARCUTOFF is used while importing 07/04/1776 using mmddyy8. informat. SAS interprets the date as
Correct Answer
D. 2017
Explanation
When the default YEARCUTOFF is used, SAS assumes that any two-digit year between 00 and 49 represents a year in the 2000s, while any two-digit year between 50 and 99 represents a year in the 1900s. In this case, the year 76 falls between 50 and 99, so SAS interprets it as 1976. However, if the year had been 17, it would fall between 00 and 49, and SAS would interpret it as 2017. Therefore, the correct answer is 2017.
21.
Which of the following represents permanent sas library reference
Correct Answer(s)
A. Temp.data1
C. Train.data1
D. Location.data1
Explanation
The given answer options consist of different library references in SAS. The "Temp.data1" represents a temporary SAS library reference, while "Work.data1" represents a work library reference. However, "Train.data1" and "Location.data1" represent permanent SAS library references as they do not indicate temporary or work libraries.
22.
Files stored in temporary library will be deleted at the end of the sas session
Correct Answer
A. True
Explanation
Files stored in the temporary library in SAS will be deleted at the end of the SAS session. This means that any files or data stored in the temporary library will not persist after the session is closed. It is important to note that temporary libraries are typically used for temporary storage or intermediate processing, and should not be relied upon for long-term storage of data.
23.
Following sas statement is used to retain values across iterations
Correct Answer
C. Retain
Explanation
The SAS statement "Retain" is used to retain values across iterations. It allows variables to retain their values from one iteration of the data step to the next. This is useful when you want to carry forward values or perform calculations based on previous iterations. The "Retain" statement is typically used in conjunction with the "Set" statement to read in data from a previous iteration or to initialize the values of variables before the data step begins.
24.
Following can be used to hold a record across multiple iterations of the DATA step
Correct Answer
B. @@
Explanation
The correct answer is @@. In SAS, @@ is used to hold a record across multiple iterations of the DATA step. It is known as a double trailing at sign and is used with the INPUT statement. It tells SAS to read multiple records into a single observation, rather than reading one record per observation. This is useful when dealing with data that is not structured in a typical row-by-row format, such as data with multiple observations per record. By using @@, SAS will continue reading records until the INPUT statement is satisfied, allowing for more flexibility in data processing.