SAS Certified Base Programmer 123 Questions (87)
The SAS data set BANKS is listed below:
BANKS
name rate FirstCapital 0.0718 DirectBank 0.0721 VirtualDirect 0.0728
The following SAS program is submitted:
data newbank; do year = 1 to 3; set banks; capital + 5000; end; run;
Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?
A. 0 observations and 0 variables
B. 1 observations and 4 variables
C. 3 observations and 3 variables
D. 9 observations and 2 variables
Topics:
SAS Base Questions |
9 Comments »
B
The answer should be 3 observations and 4 variables
The answer is 3 observations and 4 variables
pls explain it
Explain please…
why there are 4 variables?
can you explain this
can you plz explain in detail why getting this result
There are two variables created, year and capital, in the program. And there are another two variables contained in the data set BANKS, which will be read into the new data set newbank by executing “set” and “run” statements. So there are four variables.
Only encountered “run” statement, the values in the program data vector are written to the output data set as an observation. So the do loop only changes the values in the program data vector. And the end of data set banks is touched after three iterations in the do loop.
I feel this questions emphasize the understanding of data step processing.