01-24-2013 06:56 AM
"Why If condition won't work in Procedures"????
As Per my knowledge IF condition works only in Proc Report Procedure that too in Compute block only.
Could any one explain me why IF won't works in all other procedures??
Thanks in Advance :-)
01-24-2013 11:23 AM
The short answer: the procedures weren't programmed that way.
My guess why not: make sure your data is what you want to analyze before going to procedures else they get very complicated to program and maintain.
What procedure do want to use that you think NEEDS an IF statement?
If you want a procedure to process some of the data based on a condition that is accomplished with a WHERE statement as part of the procedure or as a data set option;
01-24-2013 01:57 PM
WHERE statements just subset or filter your data.
IF statements do a whole lot more than just filter data. Their primary use in DATA steps is conditional processing (IF condition true then do something), hence their implementation in REPORT procedure COMPUTE blocks.
Doing IF conditional processing in procedures other than REPORT doesn't make sense because their purpose is to transform data and that can be handled in the DATA step. And if all you want to do is filter data then WHERE statements are available for that.