Day of Week (Mon-Sun) Modeling in SAS

derreckn

New Member
Hello,

If I am trying to explain Y using the day of the week (Monday, Tuesday, Wednesday, etc) in SAS. can I simply convert each day to a numerical form?

For example:

Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6
Sunday = 7

Mean Joe

TS Contributor
You don't need to convert.

If you do convert, I think you should use the CLASS statement in the model. Otherwise you'll only get one result for the day variable, and the interpretation would be something like that Wednesday (day=3) has 2 times the effect of Tuesday (day=2) relative to Monday.

derreckn

New Member
I'm sorry, I am not familiar with the class method. I am a very beginner with SAS. What is the best way to build my model using the days of the week? Can you point me in the right direction or show me a simple class method for sas?Thank you

hlsmith

Less is more. Stay pure. Stay poor.
It is not a "Class Method", it is just using a class statement in your procedure. So, if you have a categorical variable, you list it in the class statement to inform SAS that the variable is not continuous. You use the class statement in many procedures. See below for an example:

http://v8doc.sas.com/sashtml/stat/chap30/sect11.htm

Once you start examing the syntax used in SAS, you will see the class statement used all over the place.

derreckn

New Member
So I am a bit confused as to how to predict y using "Monday". Could I instead setup dummy variables in my model.In other words, each day of the week is either true or false variable. So instead of 1-7 for the day variable I would have 7 variables representing each day of the week.

If X=
Monday:1+0+0+0+0+0+0
Tuesday: 0+1+0+0+0+0+0
Wednesday: 0+0+1+0+0+0+0
etc...

I am trying to use the day of the week to determine the willingness to pay for a product. Does the market's willingness to pay increase or decrease for any given day of the week.

Willingness to pay\$ = mon+tue+wed+thu+fri+sat+sun

hlsmith

Less is more. Stay pure. Stay poor.
If you put it into SAS as categorical names and in your class statement, they should get dummy coded automatically (100000, 010000, 001000, ... etc, and will take up 6 degrees of freedom.

derreckn

New Member
Thank you. This is helpful and as I learn SAS more I am sure I will figure the class thing out. I appreciate your time.