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?
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?
In the given SAS program, the variable 'cost' is assigned a character value ('20000') as it is enclosed in single quotes. When performing the multiplication operation (0.10 * cost), SAS will try to implicitly convert the character value to numeric. However, this will not succeed cleanly because character-to-numeric conversion issues often result in missing values unless explicitly formatted for conversion. As a result, the value for 'total' will be set to a missing numeric value (.).
given answer A is correct, thanks to automatic conversion, s. Log: "NOTE: Character values have been converted to numeric values..."