• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 955
  • Last Modified:

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

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?
Thanks.
0
franceschau_07
Asked:
franceschau_07
1 Solution
 
andymcooperCommented:
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);
    output;
  end;
run;

proc print data=tst;
run;
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now