/***************************************************************************************************************** SAS file name: return_statement.sas File location: __________________________________________________________________________________________________________________ Purpose: To demonstrate the inner workings of the Return Statement in the SAS Data Step. Author: Peter Clemmensen Creation Date: 07/03/2020 This program supports the blog post "Understand the Return Statement in SAS Data Step" on SASnrd.com *****************************************************************************************************************/ /* Example Data */ data have; input x y; datalines; 1 1 1 2 2 3 2 4 ; /* A data step has an implicit output and return statement */ data want; set have; output; return; run; /* Somewhat comparable to the Delete Statement */ data return; set have; if x = 2 then return; *output; run; data delete; set have; if x = 2 then delete; run; /* The Go To and Link Statemnets */ data goto; set have; link here; here : do; output; return; end; run; data link; set have; goto here; here : do; output; return; end; run;