sassas-visual-analytics

Beginning and end week date in SAS Visual Analytics


How can I obtain the beginning and end date of today's week in SAS Visual Analytics? Intnx function is not available like in SAS Enterprise Guide.

intnx('WEEK', today(), 0, 'B')  /*First day of week*/

intnx('WEEK', today(), 0, 'E')  /*Last day of week*/

Thanks for the suggestions.


Solution

  • This may depend on what version of SAS Visual Analytics you're using, but in mine (8.5.2), this is not directly possible, but you can get at this using old methods.

    Using New Data Item -> New Calculated Item, you can start with Now() under Date and Time, then embed that within DatePart, to get date (equivalent of TODAY() ).

    Then, using that (and you could just save that aside as a variable, perhaps, if you're going to use it for multiple things), you can determine the DayOfWeek.

    Then, use TreatAs under Numeric(Advanced) to convert that to a number, and you can use it for math. You'll end up with 3 of the previous blocks... basically in English, day minus dayofweek and day plus 7 minus dayofweek (or adjust this some depending on what you consider start/end of week).

    First Day of Week

    Last Day of Week