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

1 ACCEPTED SOLUTION
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
Moderator
/* 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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 1268 views
  • 0 likes
  • 6 in conversation