Why is the answer 8 instead of 3 observations? Shouldn't it be 3 since there are 3 A's?
conditional explicit ouput= 3
unconditional explicit output=5
Total= 8
HTH
That's a trick. You read too fast and didn't see the *2* output statements.
/* 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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.