pass iterator as value to macro function [duplicate]











up vote
0
down vote

favorite













This question already has an answer here:




  • Dynamically call macro from sas data step

    3 answers




I would like to pass do iterator as value - see example below



%macro print_to_log(val=);
%put &val;
%mend print_to_log;

data _null_;
do i = -15 to 0;
%print_to_log(val=i);
end;
run;


It only prints the character i to the log.










share|improve this question













marked as duplicate by Reeza, Community Nov 20 at 18:23


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
    – Reeza
    Nov 20 at 17:09










  • Thank you @Reeza - definitely a duplicate in concept
    – CPak
    Nov 20 at 17:17















up vote
0
down vote

favorite













This question already has an answer here:




  • Dynamically call macro from sas data step

    3 answers




I would like to pass do iterator as value - see example below



%macro print_to_log(val=);
%put &val;
%mend print_to_log;

data _null_;
do i = -15 to 0;
%print_to_log(val=i);
end;
run;


It only prints the character i to the log.










share|improve this question













marked as duplicate by Reeza, Community Nov 20 at 18:23


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
    – Reeza
    Nov 20 at 17:09










  • Thank you @Reeza - definitely a duplicate in concept
    – CPak
    Nov 20 at 17:17













up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:




  • Dynamically call macro from sas data step

    3 answers




I would like to pass do iterator as value - see example below



%macro print_to_log(val=);
%put &val;
%mend print_to_log;

data _null_;
do i = -15 to 0;
%print_to_log(val=i);
end;
run;


It only prints the character i to the log.










share|improve this question














This question already has an answer here:




  • Dynamically call macro from sas data step

    3 answers




I would like to pass do iterator as value - see example below



%macro print_to_log(val=);
%put &val;
%mend print_to_log;

data _null_;
do i = -15 to 0;
%print_to_log(val=i);
end;
run;


It only prints the character i to the log.





This question already has an answer here:




  • Dynamically call macro from sas data step

    3 answers








sas






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 at 17:05









CPak

9,3991723




9,3991723




marked as duplicate by Reeza, Community Nov 20 at 18:23


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Reeza, Community Nov 20 at 18:23


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
    – Reeza
    Nov 20 at 17:09










  • Thank you @Reeza - definitely a duplicate in concept
    – CPak
    Nov 20 at 17:17














  • 1




    Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
    – Reeza
    Nov 20 at 17:09










  • Thank you @Reeza - definitely a duplicate in concept
    – CPak
    Nov 20 at 17:17








1




1




Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
– Reeza
Nov 20 at 17:09




Use CALL EXECUTE to call the macro or DOSUBL instead. There's an example in the documentation.
– Reeza
Nov 20 at 17:09












Thank you @Reeza - definitely a duplicate in concept
– CPak
Nov 20 at 17:17




Thank you @Reeza - definitely a duplicate in concept
– CPak
Nov 20 at 17:17












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Will this work for you, if you use another macro instead of null ds as below?



%macro print_to_log(val);
%put &val;
%mend print_to_log;

%macro loop;
%do i = -15 %to 0;
%print_to_log(&i);
%end;
%mend loop;

%loop;





share|improve this answer




























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Will this work for you, if you use another macro instead of null ds as below?



    %macro print_to_log(val);
    %put &val;
    %mend print_to_log;

    %macro loop;
    %do i = -15 %to 0;
    %print_to_log(&i);
    %end;
    %mend loop;

    %loop;





    share|improve this answer

























      up vote
      0
      down vote













      Will this work for you, if you use another macro instead of null ds as below?



      %macro print_to_log(val);
      %put &val;
      %mend print_to_log;

      %macro loop;
      %do i = -15 %to 0;
      %print_to_log(&i);
      %end;
      %mend loop;

      %loop;





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Will this work for you, if you use another macro instead of null ds as below?



        %macro print_to_log(val);
        %put &val;
        %mend print_to_log;

        %macro loop;
        %do i = -15 %to 0;
        %print_to_log(&i);
        %end;
        %mend loop;

        %loop;





        share|improve this answer












        Will this work for you, if you use another macro instead of null ds as below?



        %macro print_to_log(val);
        %put &val;
        %mend print_to_log;

        %macro loop;
        %do i = -15 %to 0;
        %print_to_log(&i);
        %end;
        %mend loop;

        %loop;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 at 18:02









        Rhythm

        2106




        2106















            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python