Re: nested data step

Reply
Trusted Advisor
Posts: 1,934

Re: nested data step

Perhaps you can explain more why you want "nested data step", as there are likely other ways to create SAS code to handle your situation.

For example, you can have a subroutine within a SAS data step, using the LINK command. Macros also provide a way to create "nested" code or subroutines.

Occasional Contributor
Posts: 19

Re: nested data step

Posted in reply to PaigeMiller

I want to call a macro from data step 1 which takes input from a table called in data step1.

This macro runs data step2 which would ultimately create some global macro variable

which i want to use in data step1.

It is possible to call data step 2 from data step1 using macro and I could actually create those global macro variable.

But I am not able to use those created macro variable in data step1.

BTW thanks for your reply

Respected Advisor
Posts: 3,799

Re: nested data step

Posted in reply to gupta_shubham

Sounds like a job from DOSUBL but I bet you don't really need to do that way.

Tell us what you want to do in general terms.  Not I want to call data step 2 from data step 1.

Occasional Contributor
Posts: 19

Re: nested data step

Posted in reply to data_null__

I have created a macro which takes some input and do some calculation using data step and returns a macro variable (generated in data step using call symputx).

I want to run this macro over lots of values which are stored in a table (say test) and to update the table test with macro output.

Trusted Advisor
Posts: 1,934

Re: nested data step

Posted in reply to gupta_shubham

Without more details, I can't be sure, but it still seems to me like the LINK command allows you to do this in a single data step, without macro variables at all.

I have created a macro which takes some input and do some calculation using data step

It would be very helpful at this point if you could explain what the macro does, what calculations are performed, and where the data comes from that the macro uses; and is this the same data set that you are mentioning that needs the macro variable later?

Occasional Contributor
Posts: 19

Re: nested data step

Posted in reply to data_null__

Thanks man dosubl works.

U are awesome

Ask a Question
Discussion stats
  • 5 replies
  • 1105 views
  • 0 likes
  • 3 in conversation