nested data step

Reply
Occasional Contributor
Posts: 19

nested data step

How to run nested data step in sas or

how to call a data step in another data step ?

Super Contributor
Posts: 282

Re: nested data step

Posted in reply to gupta_shubham

Hi,

A data step is boundary is met when another data statement is encountered and so data steps cannot be nested.

Regards,

Amir.

Super Contributor
Posts: 339

Re: nested data step

It is actually arguably possible to nest datastep with SAS9.2 but it requires tedious efforts.

Using PROC FCMP, you can create a routine that you can call in your outer data step.

With the RUN_MACRO and dosubl tools in proc FCMP, you can force SAS to execute the inner data step that you would preemptively have wrapped in a macro. The RUN_MACRO allows you to execute the macro right away rather than piling it up to be executed at the end of your current data step like with call execute.

Typically, there would be other better ways around so if you are not an experienced SAS user, you would probably be better detailing the intention behind your code as there are very likely ways around that. However, if you are in for a nice self-learning experience, look into

http://support.sas.com/resources/papers/proceedings12/227-2012.pdf

Cheers

Vince

Ask a Question
Discussion stats
  • 2 replies
  • 844 views
  • 0 likes
  • 3 in conversation