What is the primary effect of the RETAIN statement in a SAS DATA step?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's the deal — b is correct because by default, SAS resets non-retained variables to missing at the start of each DATA step iteration. RETAIN prevents this reset, carrying values forward — essential for running totals, flags, and lag calculations.
Full explanation below image
Full Explanation
B is correct because by default, SAS resets non-retained variables to missing at the start of each DATA step iteration. RETAIN prevents this reset, carrying values forward — essential for running totals, flags, and lag calculations. A is wrong; RETAIN works within a DATA step, not with macro variables. C describes DROP/KEEP statements. D is wrong; RETAIN does not protect against SET/MERGE overwriting.