How do i set the first day of the week is Monday in SAS, and create a weekly report?

Posted on 2007-10-01
Last Modified: 2013-11-16
I'm currently working on creating a weekly report.  in SAS, the default first day of the week is Sunday, however, I want it to be Monday through Sunday, and then group the report weekly.  How should i do?
Question by:franceschau_07
    1 Comment
    LVL 2

    Accepted Solution

    You need to create a new variable, which is the Saturday before the date in question. To do this, use intnx, but with 'week.7' as the 1st argument. Note - the number is the number of days after Saturday, so 1=Sunday, 2=Monday etc. e.g.:

    data tst;
      format DATEVAR WEEKVAR date9.;
      do DATEVAR='18Oct2007'd, '19Oct2007'd, '20Oct2007'd, '21Oct2007'd, '22Oct2007'd, '23Oct2007'd;
        WEEKVAR = intnx('week.7',DATEVAR,0);

    proc print data=tst;

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    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

    Introduction After workin in a plethora of programming languages like C, Pro*C, ESQL/C, C++, VC++, VB, Java, HTML,JavaScipt etc, technologies and frameworks like JSP, Servlets, Struts, Spring, IBatis etc and databases like MS Access, SQLServer, Inf…
    Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
    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…

    737 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

    18 Experts available now in Live!

    Get 1:1 Help Now