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?
A. Problems
B. No Problems
C. ' ' (missing character value)
D. The value can not be determined as the program fails to execute due to errors.
Click Comment link to get answer
The Answer will be A. as the program has an error which is compilation error so this will falg _ERROR_ to 1.
ReplyDeletei think the error occurs in "infile" statement.
Any suggestions!!!!
This comment has been removed by the author.
ReplyDeleteAnswer A
ReplyDeleteAnswer is A
ReplyDeleteIts' A
ReplyDeleteyes A us answer, if we follow informat dollar8. what is value of desc variable ?
ReplyDeleteyes A us answer, if we follow informat dollar8. what is value of desc variable ?
ReplyDeleteAns is A.. madhu
ReplyDeleteAnswer is A. But if use the informat COMMA6.0 in input function then it will not give any error.
ReplyDeleteThe Answer is ultimately A. Problems
ReplyDeleteReason:
Input statment should be like below;
input @1 salary dollar6.;
or
input @1 salary comma6.;
No problem ans B
ReplyDeleteThe answer is A if your SAS environment allows variable names longer than 8 characters. If not (like mine) then the answer is D as it fails to execute.
ReplyDeleteThe Answer is "A" as the informat provided in incorrect & sas cannot read $ and , symbols by giving 6. informat.....
ReplyDeleteso, it gives _error_ = 1
so it will take the value to be "problem" for the description variable..
the answer is A
ReplyDeleteit is data error so the program executes and salary will have a missing numeric value which is period and description as problems
a
ReplyDeleteD
ReplyDeleteSalary is in non-standard numeric format and hence SAS cannot read without using informat. SAS generates error and print the decription as problems in list file and sets salary as missing value.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteans is D.....
ReplyDeleteAnswer is D ; As infile 'amout" says physical file doesnot exist
ReplyDeleteA?
ReplyDeleteD is the correct answer
ReplyDeleteIts A, SAS will throw an error in compiling the statement , there is a "Problem" in the code
ReplyDeleteMy friends here he ask about variable description so answer is "A"........ :)
ReplyDelete3
ReplyDeleteyes ans is B coz programe is successully run. but salary is missing their not issue
ReplyDeleteA
ReplyDeleteI think I agree with hayder, that the ans is B It is a data error and that won;t stop the program from executing.
ReplyDeleteCan the admin plz comment
correct answer is D
ReplyDeleteANSWER A
ReplyDeleteAnswer A:
ReplyDeleteIncorrect 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'.
(That's almost funny. :-/)
The statement:
length description $ 11;
prior to the if statement is required to avoid this.
Nigel
d
ReplyDelete