Question : Which one of the following is true when SAS encounters a data error in a DATA step?
1. The DATA step stops executing at the point of the error, and no SAS data set is created. 2. A note is written to the SAS log explaining the error, and the DATA step continues to execute. 3. A note appears in the SAS log that the incorrect data record was saved to a separate SAS file for further examination. 4. The DATA step stops executing at the point of the error, and the resulting DATA set contains observations up to that point.
Correct Answer : 2
Explanation: Notice what happens when SAS encounters invalid data.
1 An error message is printed on the log.
NOTE: Invalid data for DOB in line 6 9-15. 2 The raw data line is printed with a ruler.
RULE:----+----1----+----2----+----3----+----4----+----5----+----6 6 1 SMITH 1/23/66 68 144 M 26 Aside: Notice how the error message "for DOB in line 6 9-15" points you to the variable being read, the line number and the column range where the input error occurred.
3 The resulting values of all the variables (after the input process) are printed.
ID=1 LASTNAME=SMITH DOB=. HEIGHT=68 WEIGHT=144 GENDER=M AGE=26 _ERROR_=1 _N_=1 Aside: The special variables _ERROR_ and _N_ are used in the data set to indicate whether a run-time error has occurred with this observation, and to indicate how many times the data step has executed. These two variables are not included in the output dataset.
4 The data step keeps running.
NOTE: The data set WORK.WONTWORK has 4 observations and 7 variables. Also see that the Proc Print output shows that a dataset with values was created. All the variables have been given values for all the observations (a missing value is a value). Data errors occur when some data values are not appropriate for the SAS statements that you have specified in the program. For example, if you define a variable as numeric, but the data value is actually character, SAS generates a data error. SAS detects data errors during program execution and continues to execute the program, and does the following: writes an invalid data note to the SAS log. prints the input line and column numbers that contain the invalid value in the SAS log. Unprintable characters appear in hexadecimal. To help determine column numbers, SAS prints a rule line above the input line. prints the observation under the rule line. sets the automatic variable _ERROR_ to 1 for the current observation.
Question : You have been given below dataset, how many observation and variables it has ?
1. 10 Observation and 10 Variables
2. 9 Observation and 9 variables
3. 10 Observation and 9 variables
4. 9 observation and 10 variables
5. There is one value missing, so we cannot tell.
Correct Answer : 3 Explanation: In SAS dataset, rows are known as observation and columns are known as variables. Hence, there are in total 10 rows and 9 columns which translates to the 10 observation and 9 variables. And if any particular value is missing than it will not affect it.
Question : You have been given below SAS program data hadoopexam.courses; infile hadoopexam1; input name $ price ; run; proc sort data=hadoopexam.courses; by price; run; proc print data=hadoopexam.courses; run;
You run this program, than how many steps will be processed in total?
1. 1
2. 2
3. 3
4. 10
5. How SAS executes the steps internally, cannot be identified.
Correct Answer : 3 Explanation: As you know, as soon as SAS finds the RUN, PROC or DATA statement. It will stop there and execute the previous step. Hence there are in total 3 steps which will be executed here.