how to apply proc format in dataset

Reply
Occasional Contributor
Posts: 15

how to apply proc format in dataset

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;

Trusted Advisor
Posts: 1,137

Re: how to apply proc format in dataset

Posted in reply to padmakumariMiriyala

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
Ask a Question
Discussion stats
  • 1 reply
  • 162 views
  • 0 likes
  • 2 in conversation