The following SAS program is submitted:
data work.retail;
cost = '20000';
total = .10 * cost;
run;
Which one of the following is the value of the variable TOTAL in the output data set?
A. 2000
B. '2000'
C. . (missing numeric value)
D. ' ' (missing character value)
Click Comment link to get answer
Correct answer is 'A'
ReplyDeleteAnswer is 'A'
ReplyDeleteThis comment has been removed by the author.
DeleteA
ReplyDeletec, because cost is a character variable.
ReplyDeletein this case
DeleteSAS will convert char values to numeric
here's the log output :
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
3:15
Hi - first of all let me thank you for taking all the efforts in bringing together all this, for the benefit of ppl like me who are planning to take up the cert exam.
ReplyDeleteI would really appreciate if you could please remove the conflicting answers from the list and also add in the comments as to why it should be the correct answer and the others.
fuck you
Deletewhile calculating total cost 20000 will be autoconverted to numeric value because it is standard numeric datatype it can be calculated simply,
Delete20000*0.1=2000
The answer is A.
ReplyDeleteto an extent, SAS automatically converts character to numeric. eben though cost is character. due to automatic conversion
here we are getteng 2000
Answer is C
ReplyDeleteAnswer is 'A'
ReplyDeleteBecause the character value is automaticaly converted to numberic by SAS.
Here's the log results
"NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column)"
yes this is correct
Deletegot the same result myself
Character values have been converted to numeric values at the places given by: (Line):(Column).
3:15
NOTE: The data set WORK.RETAIL has 1 observations and 2 variables.
ans is "D"
ReplyDeleteAnswer is 'A'
ReplyDeleteSame reason as Prashant...
Character values have been converted to numeric values at the places given by: (Line):(Column)
The answer is 'A' I tried it.
ReplyDeleteJust ran the program in sas, the correct answer is A, cost is automatically converted to numeric.
ReplyDeleteYes; SAS log will give you comment on automatic conversion.
ReplyDeleteWhat if it was like this "20000"; still able to convert?
@ SWAPNA ... U R right swapna sas will take auto conversions
ReplyDeleteAnswer is A. When valid operators are used, SAS automatically converts character variables with numbers to numeric and provides the answer in numeric 'BEST12.' format with length of default 8 bytes.
ReplyDeleteLog reads:
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
505:15
NOTE: The data set WORK.RETAIL has 1 observations and 2 variables.
Hi Guys,
ReplyDeleteTo avoid seeing this message in log- Character values have been converted to numeric values at the places given by:
(Line):(Column).
You can explicitly convert the character values of char variable (in this case cost to numeric values by using the INPUT function.)
use informat with input. here informat is 5 becoz 20000 value:
use this prgm- msg will disappear from log. as a good programmer, your log be clear.
data work.retail;
cost = '20000';
total = .10 * cost;
run; *char values converted to num in log- to avoid this msg, give input stmt;
data work.retail1;
cost = '20000';
cost1= input (cost, 5.);
total = .10 * cost1;
run;
Hope it helps.
A
ReplyDelete0.10 is Numeric: Hence
ReplyDelete20000*.10 = 2000;
hence answer is 'A'
A
ReplyDeleteVariable Type Len Pos
ReplyDelete---------------------
name Char 8 0
salary Char 8 16
status Char 8 8
name status salary
----------------------
Liz S 15,600
Herman S 26,700
Marty S 35,000
The following SAS program is submitted:
proc print data=work.salaries;
where salary<20000;
run;
What is displayed in the SAS log after the program is executed?
a. A NOTE indicating that 1 observation is read.
b. A NOTE indicating that 0 observations were read.
c. A WARNING indicating that character values have been converted to numeric values.
d. An ERROR indicating that the WHERE clause operator requires compatible variables.
why not choose c?
Someone can let me know, when SAS automatically converts character to numeric. Base on what kind of condition?
ReplyDelete56 data work.retail;
57 cost = '20000';
58 total = .10 * cost;
59 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
58:15
NOTE: The data set WORK.RETAIL has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.02 seconds
ans is 2000
Really cool post, highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank you for this rare info!
ReplyDeleteSAS Online Training
Here's an interesting variation.
ReplyDeletedata work.retail;
total = '';
total = .10 * 2000 ;
proc print data=work.retail;
run;
I should point out that the 0.1 does not force total to be numeric. It's the * operator.
ReplyDeleteRun the following code:
ReplyDeletedata work.retail;
cost = '20000';
total = .10 * cost;
run;
The value 2000 will be assigned to Total and log will say the following
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
Hence the answer is A
A
ReplyDeleteA
ReplyDeleteA
ReplyDeleteMumbai Railway will release RRB Mumbai Group D result on official railway website. Mumbai Railway Group D Cutoff mark is also announced. The RRB Mumbai Railways Group D exams got over. Over 2 Crore candidates are written the exam. The most awaited RRB Mumbai Group D CBT1 Results 2018 will be released soon. The candidates who are all wrote RRB Group D CBT1 for the Indian Railway Helper, Gateman, Trackman, Porter, Track Maintainer, Pointsman and Hospital Attendant recruitment can only able to download Mumbai RRB Group D result Selection list pdf.
ReplyDeletenice post Facebook AR
ReplyDeleteAugmented Reality
Snapchat Lens
thanks to the admin to for this kind of post you can get the latest freejobalert updates
ReplyDeleteUser can grab Ustraa Coupons
ReplyDeleteGood Job
ReplyDelete