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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.