BookmarkSubscribeRSS Feed
ericliuzh1
Obsidian | Level 7

#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

11 REPLIES 11
Reeza
Super User

Which version of the study guide are you working with? Version 4?

ericliuzh1
Obsidian | Level 7

Yes, Version 4.

Astounding
PROC Star

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.

ericliuzh1
Obsidian | Level 7

Sorry, it was a typo. Same variable names.

ballardw
Super User

@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.

ericliuzh1
Obsidian | Level 7

Will upload a snapshot tomorrow morning. Thanks.

ericliuzh1
Obsidian | Level 7

Attached is the quiz question.

andreas_lds
Jade | Level 19

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.
Reeza
Super User
version 4 was just released, and that means it's sometimes a bit buggy 😞
ericliuzh1
Obsidian | Level 7

Agreed. Found another two errors. Now, I am confident with my answers. Thanks.

Tom
Super User Tom
Super User

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


 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 11 replies
  • 1270 views
  • 2 likes
  • 6 in conversation