BookmarkSubscribeRSS Feed
allurai0412
Fluorite | Level 6

hi,

I am increementing 'spcday' by one month.....as  ' nxt_spcday'.....but while increementing "nxt_spcday' should not a 'SUNDAY'

Till now i did only for one month....how can do this for next 5 years ...?

data have ;

input scheme$ spcday DDMMYY10.;

nxt_spcday=intnx('month',spcday,1,'s');

if weekday(nxt_spcday)=1

then nxt2_spcday=intnx('day',nxt_spcday,1);

FORMAT spcday DDMMYY10. ;

format nxt_spcday ddmmyy10.;

format nxt2_spcday ddmmyy10.;

datalines;

IV 14/03/2013

;

Regards

ALLU

2 REPLIES 2
PGStats
Opal | Level 21

Try something like this :

data have;

format spcday nxt_spcday ddmmyy10.;

input scheme$ spcday DDMMYY10.;

do _n_ = 1 to 5*12;

     nxt_spcday=intnx('month',spcday,_n_,'s');

     if weekday(nxt_spcday)=1

          then nxt_spcday=intnx('day',nxt_spcday,1);

     output;

     end;

datalines;

IV 14/03/2013

;

PG

PG
allurai0412
Fluorite | Level 6

Thanks a lot..

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1096 views
  • 4 likes
  • 2 in conversation