BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
clq
Calcite | Level 5 clq
Calcite | Level 5

 

 

Why is the answer 8 instead of 3 observations? Shouldn't it be 3 since there are 3 A's?

 

 

 

 

Screen Shot 2018-08-27 at 4.13.09 PM.pngScreen Shot 2018-08-27 at 4.13.09 PM.png

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
novinosrin
Tourmaline | Level 20

conditional explicit ouput=      3 

unconditional explicit output=5

Total=                                     8

 

HTH

ChrisNZ
Tourmaline | Level 20

That's a trick. You read too fast and didn't see the *2* output statements.

AndrewHowell
Barite | Level 11
/* Think of the code as follows */
data WORK.ONE WORK.TWO;
   set WORK.INPUT;
  if Var1='A' then output WORK.ONE;
  output /* to both WORK.ONE and WORK.TWO */;
run;
ballardw
Super User

1) create the data set(s).

data work.input;
   input var1 $ var2 $;
datalines; 
A  one
A  two
B  three
C  four
A  five
;
run;

for example.

 

2) run the code.

3) examine the results.

4) figure out which bit you missed along the way to the answer.

 

You'll learn a lot that way.

 

Depending on the source of these questions there may also be typos in the answer keys.

sas-innovate-wordmark-gradient-background 3.pngSAS Innovate

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 3584 views
  • 0 likes
  • 6 in conversation