Premium

Base SAS Certified Associate: Programming Fundamentals Using SAS Questions and Answers (Dumps and Practice Questions)



Question : The contents of the raw data file AMOUNT are listed below:

--------10-------20-------30
$1,234
The following SAS program is submitted:
data test;
infile 'amount';
input @1 salary 6.;
if _error_ then description = 'Problems';
else description = 'No Problems';
run;
Which one of the following is the value of the DESCRIPTION variable?



  : The contents of the raw data file AMOUNT are listed below:
1. Problems
2. No Problems
3. ' ' (missing character value)
4. The value can not be determined as the program fails to execute due to errors


Correct Answer : 1


Explanation:As the program has an error IT IS DUE TO DATA ERROR. IN COMPILATION ERROR THE PROGRAMM STOP NOT EXECUTED. HERE THE PROGRAMM EXECUTE FULLY WITH ERROR IN LOG WINDOW.

Reason:
Input statment should be like below;
input @1 salary dollar6.;
or
input @1 salary comma6.;
informat provided in incorrect and sas cannot read $ and , symbols by giving 6

Incorrect informat in the input statement, salary is missing '.' during execution, the if statement executes, assigning the description text, with _error_ = 1.

B is ruled out, for another reason - because the length of the variable description is determined in the if statement by the character string first encountered: 'Problems' during
compilation, so that if _error_ = 0 a truncated 'No Probl' (8 characters) would be stored in the variable and appear in the dataset not 'No Problems'

The DOLLARw.d format writes numeric values with a leading dollar sign, a comma that separates every three digits, and a period that separates the decimal fraction.
Examples
put @3 netpay dollar10.2;
Value of netpay
1254.71
Results
$1,254.71





Question : The contents of the raw data file NAMENUM are listed below:

--------10-------20-------30
Joe xx
The following SAS program is submitted:
data test;
infile 'namenum';
input name $ number;
run;
Which one of the following is the value of the NUMBER variable?
  : The contents of the raw data file NAMENUM are listed below:
1. xx
2. Joe
3. . (missing numeric value)
4. The value can not be determined as the program fails to execute due to errors.


Correct Answer : 3


Explanation: missing value, since a numeric value is expected for the variable been read, and a character value was found.
You have given name as character and there was no delimiter means default space will be used as delimiter here. So name will read Joe and number is expecting numeric value but it
reads xx, so number is set to missing.
SAS encounters character data for numeric data and sets _error_=1. However, SAS still runs the code and generates an list file with name=Jeo and number is set to a missing value.






Question : Which one of the following statements is true regarding the SAS automatic _ERROR_ variable?

  : Which one of the following statements is true regarding the SAS automatic _ERROR_ variable?
1. The _ERROR_ variable contains the values 'ON' or 'OFF'.
2. The _ERROR_ variable contains the values 'TRUE' or 'FALSE'.
3. The _ERROR_ variable is automatically stored in the resulting SAS data set.
4. The _ERROR_ variable can be used in expressions or calculations in the DATA step.

Correct Answer : 4

Explanation:

Automatic Variables
Automatic variables are created automatically by the DATA step or by DATA step statements. These variables are added to the program data vector but are not output to the data set
being created. The values of automatic variables are retained from one iteration of the DATA step to the next, rather than set to missing.
Automatic variables that are created by specific statements are documented with those statements. Two automatic variables are created by every DATA step: _N_ and _ERROR_.

_N_
is initially set to 1. Each time the DATA step loops past the DATA statement, the variable _N_ increments by 1. The value of _N_ represents the number of times the DATA step has
iterated.

_ERROR_
is 0 by default but is set to 1 whenever an error is encountered, such as an input data error, a conversion error, or a math error, as in division by 0 or a floating point overflow.
You can use the value of this variable to help locate errors in data records and to print an error message to the SAS log.
For example, either of the two following statements writes to the SAS log, during each iteration of the DATA step, the contents of an input record in which an input error is
encountered:

if _error_=1 then put _infile_;

if _error_ then put _infile_;



Related Questions


Question : You have been working following SAS files, you need to find which of the following a permanent file is?


 : You have been working following SAS files, you need to find which of the following a permanent file is?
1. SASHELP.PrdSale

2. SASUSER.HESALES

3. SUBSCRIBER.COURSES

4. All of the above



Question : You have been working with the HadoopExam subscriber data. You need to work on some temporary data for the all the subscriber in last one
year and named as HESUBSCRIBER. How can you reference a temporary SAS data set named HESUBSCRIBER?
A. HESUBSCRIBER
B. Work. HESUBSCRIBER
C. HE. HESUBSCRIBER
D. HE.SUBSCRIBER

 : You have been working with the HadoopExam subscriber data. You need to work on some temporary data for the all the subscriber in last one
1. A,B
2. B,C
3. C,D
4. A,D
5. B,D


Question : You have been given below SAS dataset

What is the default length of the variable fee?

 : You have been given below SAS dataset
1. 5

2. 6

3. 7

4. 8

5. Looking at sample data, we cannot default length.



Question : You have been given below SAS program, how many statements are there ?
data
hadoopexam.courses;
infile hadoopexam1; input name $ price ;
run;

 : You have been given below SAS program, how many statements are there ?
1. 4

2. 5

3. 6

4. 7



Question : How do you define a SAS library?
A. It is a collection of SAS files.
B. It is a collection of physical SAS files.
C. It is a group files in a folder
D. It is a collection of folders

 : How do you define a SAS library?
1. A,B,C
2. B,C,D
3. A,C,D
4. A,B,D


Question : Which of the following is best suitable option on all the SAS platform, so that SAS ouput can be generated in HTML format?

 : Which of the following is best suitable option on all the SAS platform, so that SAS ouput can be generated in HTML format?
1. You must use system options

2. You have to use dataset specific options

3. By default on all the platform it will be HTML format only

4. You should use proper programming statement to generate HTML format output