Hi..
"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 🙂
Regards.
Sanjeev.K
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;
Because there's a WHERE clause and its more efficient that IF statements.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.