Using sysfunc with intnx

From sasCommunity
Revision as of 20:44, 12 April 2011 by ArtCarpenter (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Don Henderson to SAS-L on Friday 2008-Jun-06

Depends on how you use it. Nested %sysfunc calls are not always needed. It depends on whether you can use SAS functions to do what you what instead of addition/subtraction. Consider the following:

%put Yesterday: %sysfunc(intnx(Day,"&sysdate"d,-1),yymmdd10);
%put Tomorrow:  %sysfunc(intnx(Day,"&sysdate"d, 1),yymmdd10);
%put Beginning of Last Week: %sysfunc(intnx(Week,"&sysdate"d,-1),yymmdd10);
%put Beginning of This Week: %sysfunc(intnx(Week,"&sysdate"d, 0),yymmdd10);
%put Beginning of Next Week: %sysfunc(intnx(Week,"&sysdate"d, 1),yymmdd10);