Last Month with appropriate year as a macro variable

Posted on 2010-01-07
Last Modified: 2013-11-16

 I have a date from TODAY(), I need to create a macro variable with a value FILE<lastmnth's monthyear>. How can I do this?

For example if Today() is Jan 10 2010 then my macro variable would have a value FILEDEC2009
                                     is Dec 25 2009 then my macro variable would have a value FILENOV2009

Question by:LuckyLucks
    1 Comment
    LVL 9

    Accepted Solution

    This should give you what you are asking for.

    DATA _NULL_;
        CALL SYMPUT('MacroVar','FILE'||PUT(INTNX('MONTH',TODAY(),-1),MONYY7.));

    %PUT &MacroVar;

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
    I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    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

    24 Experts available now in Live!

    Get 1:1 Help Now