/ Published in: SAS
You can use the goto statement to have SAS process statements in some other part of your program, by providing a label followed by a colon before the statements you wish to jump to. Label names follow the same rules as variable names, but have a different name space. When a labeled statement is encountered in normal processing, it is ignored.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/*Example*/ data two; set one; if x ^= . then goto out; x = (y + z) / 2; out: if x > 20 then output; run; /*Example with data*/ data class; input name $ 1-8 sex $ 11 age height weight; select (name); when ('Alice') do; goto Alice; end; when ('Becka') do; goto Becka; end; when ('Gail') do; goto Gail; end; end; Alice: x=4; return; Becka: x=5; return; Gail: x=6; return; datalines; Alice F 13 56.5 84.0 Becka F 13 65.3 98.0 Gail F 14 64.3 90.0 run;
URL: http://jaredprins.squarespace.com/blog/2008/5/26/sas-flow-control-the-goto-statement.html