Help using Base SAS procedures

Why no output for cases with age<=3 ?

Reply
Frequent Contributor
Posts: 131

Why no output for cases with age<=3 ?

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;
Frequent Contributor
Posts: 131

Re: Why no output for cases with age<=3 ?

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;
Frequent Contributor
Frequent Contributor
Posts: 94

Re: Why no output for cases with age<=3 ?

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.
Super Contributor
Super Contributor
Posts: 3,174

Re: Why no output for cases with age<=3 ?

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
Ask a Question
Discussion stats
  • 3 replies
  • 94 views
  • 0 likes
  • 3 in conversation