Hi all

I have date variable of the format

​​​​​​----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input long rdq
19810216
19810220
19810225
19810303
19810304
19810303
19810312
19810311
19810318
19810317
19810317
19810320
19810317
19810316
19810317
19810318
19810318
19810324
19810326
19810325
19810325
19810323
19810401
19810409
19810410
19810409
19810416
19810416
19810417
19810413
19810415
19810417
19810416
19810415
19810417
19810417
19810416
19810415
19810414
19810417
19810417
19810417
19810414
19810415
19810417
19810413
19810416
19810414
19810416
19810416
19810416
19810417
19810414
19810414
19810416
19810423
19810423
19810421
19810423
19810422
19810421
19810422
19810423
19810422
19810424
19810424
19810422
19810423
19810424
19810423
19810424
19810423
19810424
19810423
19810422
19810421
19810423
19810424
19810422
19810423
19810422
19810422
19810425
19810421
19810421
19810422
19810422
19810424
19810420
19810422
19810420
19810424
19810427
19810427
19810428
19810430
19810428
19810428
19810429
19810428
end
------------------ copy up to and including the previous line ------------------

I want to create three variables:
year: this should be the year variable (e.g. 1980, 1981...)
quarter: this should take values from 1 to 4 consistent with the quarter of the year
month: this should take values 1 to 3 consistent with the months of the quarter
week: this should take values 1 to 4 consistent with the weeks of the month

I also want to clarify that I imported the data directly from excel and did not set the rdq variable as a date variable in Stata as I am not sure if this will be required before I create the quarter-week variables?

Thanks