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

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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