%SYSFUNC doesn't work

Posted on 2011-05-13
Last Modified: 2013-11-16

The following instruction gives a fault :
%LET start = 20110301 ;

    %LET strt   = %SYSFUNC(INPUTN(&start,DATE9.)) ;
    %LET strt2  = %SYSFUNC(PUTN(&start,DATE9.)) ;

WARNING: Argument 1 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set to a missing value.
Question by:sonmic
    LVL 14

    Expert Comment

    by:Aloysius Low
    do not use %let within data steps.
    what you can do is to compute the value and use call symput to put the value into the global variables:

    DATA _NULL_ ;
        strt   = INPUTN(&start,DATE9.) ;
        strt2  = PUTN(&start,DATE9.) ;

        call symput("strt", strt);
        call symput("strt2", strt2);
    RUN ;
    LVL 11

    Accepted Solution


    The %Let statememt will work, whether it is in a DATA step or not.

    The problem is that you are using the wrong format.

    %LET start = 20110301 ;
      %LET strt   = %SYSFUNC(INPUTN(&start,yymmdd8.)) ;
        %LET strt2  = %SYSFUNC(PUTN(&strt,DATE9.)) ;

    %Put strt2 = &strt2 | start = &start | strt = &strt;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction: Often, when running a query with joins, the results show up "duplicates", and often, those duplicates can be "eliminated" in the results using DISTINCT, for example. Using DISTINCT is simple: just add it after the SELECT keyword, an…
    Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
    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…

    758 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

    11 Experts available now in Live!

    Get 1:1 Help Now