Is there a way to pass the control from one part of the program to another, without the use of macros. I'm looking for something that would do a similar function as a 'go to' statement but is not restricted within one data step only.
Yes, you can use CALL EXECUTE with IF / THEN DO / END logic in a DATA step to cause later processing conditionally. Suggest using the SAS support website for SAS-hosted DOC and supplemental technical / conference reference material.
Suggested Google advanced search argument, this topic / post:
call execute data step site:sas.com
Message was edited by: sbb
I'm wondering if there is any function like the html anchor whereby you can anchor a position in the code. And then once any condition is true, all the code beyond that anchor point can be executed otherwise not.
I understand that macros would make it simple to implement, but could it be done without the use of macros?
And, as Scott says, CALL EXECUTE can place code in the program stack to execute when your "calling" data step program has ended. However, it really depends on what you want to do--CALL EXECUTE can execute program code (such as a PROC STEP) or could, but does not have to, invoke a macro program.
not automatic, but effective:
1 at start point of conditional code open fileref, say, myRef
2 push conditional code to myRef using the file statement MOD option in each subsequent data step
3 once a decision to use the conditional code is made, %include that fileref with code like[pre] data ;
if conditions = ready then do;
call execute( ' %include myRef /source2 ; ' ) ;
run ;[/pre] the point being that %include in open code will be executed unconditionally, so wrap call execute() around it to apply your conditions.