BookmarkSubscribeRSS Feed
padmakumariMiriyala
Calcite | Level 5

I try like this

data have;

infile datalines ;

input date MMDDYY10.;

format date MMDDYY10.;

datalines;

01/06/2015

01/07/2015

01/29/2015

02/06/2015

02/07/2015

;

run;

i want to apply proc format above dataset.

sas takes sunday is 1 but my requirement like this

PROC FORMAT;

VALUE $WEEK

              'Saturday'=1

                'Sunday'=2

     'Monday'=3

     'Tuesday'=4

     'Wednesday'=5

     'Thursday'=6

     'Friday'=7

QUIT;

data have1;

set have;

FORMAT DATE1 MMDDYY10.;

FORMAT DATE1 WEEKDATE9.;

RUN;

1 REPLY 1
Jagadishkatam
Amethyst | Level 16

May be this will help you

PROC FORMAT;

inVALUE $WEEK

              'Saturday'=1

                'Sunday'=2

     'Monday'=3

     'Tuesday'=4

     'Wednesday'=5

     'Thursday'=6

     'Friday'=7;

QUIT;

data have1;

set have;

date1=input(put(date,WEEKDATE9. -l),$week.);

/*FORMAT DATE MMDDYY10.;*/

/*FORMAT DATE WEEKDATE9.;*/

RUN;

Thanks,

Jag

Thanks,
Jag

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 652 views
  • 0 likes
  • 2 in conversation