BookmarkSubscribeRSS Feed
bncoxuk
Obsidian | Level 7
Guys, can you tell me why there is no output for cases with age<=30? OUTPUT statement in the ELSE should not cause any effect.

DATA work.a;
SET work.b;
IF (age>30) THEN status='mature';
ELSE THEN
DO;
status='young';
OUTPUT;
END;
RUN;
3 REPLIES 3
bncoxuk
Obsidian | Level 7
Guys, can you tell me why there is no output for cases with age below 30? The output statement should not cause effect, as it is associated with else only.

DATA work.a;
SET work.b;
IF (age>30) THEN status='mature';
ELSE THEN DO;
status='young';
OUTPUT;
END;
RUN;
DF
Fluorite | Level 6 DF
Fluorite | Level 6
Have a look at your log file for that code. You should be getting a syntax error - the "THEN" keyword is only used in the IF statement and isn't needed for ELSE.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
I have to ask why you double-posted your query/problem in this forum? Recommend you stay with one post, one topic-point or issue/problem/query....suggested forum etiquette.

Here's your first one:

http://support.sas.com/forums/thread.jspa?threadID=14647

Scott Barry
SBBWorks, Inc. Message was edited by: sbb

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 1133 views
  • 0 likes
  • 3 in conversation