#6 Assume the data set has 5 or more observations, what is the result of submitting the following program?
data a;
obsn=5;
set b (keep=var1 var2) point=obsn;
output;
stop;
run;
a. an error
b. an empty data set
c. a continuous loop
d. a data set that contains one observation
My answer is D. but the answer key is A. according to the answer key: when you use the KEEP= data set option and the POINT= option with the OUTPUT and STOP statements, your program cannot write out a single observation.
I tested the codes in SAS and did generate one observation.
Can anyone verify my result for me?
Thanks.
Eric
Which version of the study guide are you working with? Version 4?
Yes, Version 4.
It depends. The program as posted will produce an error, because the variable name changed from OBSN to OBN. But if the same name were to be used, you would get a single observation.
Sorry, it was a typo. Same variable names.
@ericliuzh1 wrote:
I tested the codes in SAS and did generate one observation.
Show the actual code you ran and the content of data set b.
I suspect @Astounding points to the difference between your code and the question.
Will upload a snapshot tomorrow morning. Thanks.
Attached is the quiz question.
Maybe the preparation guide is outdated. Using 9.4m3 a dataset with one observation was created:
12 data a; 13 obsn=5; 14 15 set sashelp.class(keep=Name Age) point=obsn; 16 17 output; 18 stop; 19 run; NOTE: The data set WORK.A has 1 observations and 2 variables.
Agreed. Found another two errors. Now, I am confident with my answers. Thanks.
Looks like you found a mistake in the quiz. Perhaps they will give you cookie it you report it?
Note that you also need to assume that the input dataset has at least the two variables listed in the KEEP= dataset option.
@ericliuzh1 wrote:
#6 Assume the data set has 5 or more observations, what is the result of submitting the following program?
data a;
obsn=5;
set b (keep=var1 var2) point=obsn;
output;
stop;
run;
a. an error
b. an empty data set
c. a continuous loop
d. a data set that contains one observation
My answer is D. but the answer key is A. according to the answer key: when you use the KEEP= data set option and the POINT= option with the OUTPUT and STOP statements, your program cannot write out a single observation.
I tested the codes in SAS and did generate one observation.
Can anyone verify my result for me?
Thanks.
Eric
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.