Hi guys,
suppose to have the following:
data DB;
input Admission :date09. Number;
format Admission date9.;
cards;
15JUN2014 4
20JUL2014 2
11JAN2015 1
18JAN2015 2
;run;
This dataset contains number of events by dates. Each date starts the first day of the week, so Sunday.
I would like to add the week number for each date and a variable that indicates the year (it is ok by using "year" function. I can do this). Moreover, I would like to fill all the remaining weeks (that here are not shown because no events are present) back and forth with respect to each date.
The desired output should be the following (indicative output is shown for simplicity):
data DB1;
input Admission :date09. Number Week_Number year;
format Admission date9.;
cards;
30DEC2013 0 1 2014
06JAN2014 0 2 2014
13JAN2014 0 3 2014
.........................
15JUN2014 4 24 2014
20JUL2014 2 29 2014
.........................
Last week of 2014
First week of 2015
........................
11JAN2015 1 2 2015
18JAN2015 2 3 2015
.........................
Last week of 2015
;run;
Can anyone help me please?
Thank you in advance!