Make 13 dates

Posted on 2012-08-31
Last Modified: 2012-09-10

The following macro will not work.

%MACRO LOOPING;                        
    %do i = 1 %to 13 ;
        %global d13_&i ;
        %let d13_&i = %sysfunc(intnx('month',&strtjr,1)) ;
    %end ;

&strtjr = 18993

What's wrong?

Question by:sonmic
    LVL 37

    Expert Comment

    It looks like you are making all the dates the same date; is that the intent? Is &strtjr = 18993 a line of code after the loop or is it just there so we know what it was in the loop? If it's actually setting the value, it certainly should happen first.

    Author Comment

    No. What i want is 13JAN2012, 13FEB2012, ............13JAN2013.
    LVL 37

    Expert Comment

    Okay. On the %let line, change the 1 to either i or i-1, whichever gives you want you want.

    Author Comment

    I get the following error message :

    ERROR: Argument 3 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.
    ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list.  Execution of %SYSCALL statement or %SYSFUNC or
           %QSYSFUNC function reference is terminated.
    LVL 37

    Accepted Solution

    Sorry. I'm not really a SAS programmer. Do you need to do &i or something? The idea is that you need to use the value of i (which is ranging from 1 to 13) there where you had the 1.

    From what I can see, I would guess that you do need the & in front of the i on the %let line.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Report events not being triggered 8 63
    sum67 challenge 35 76
    post4 challenge 28 70
    changeXy challenge 13 40
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now