Day of Week (Mon-Sun) Modeling in SAS


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.
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


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:

Once you start examing the syntax used in SAS, you will see the class statement used all over the place.
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=
Tuesday: 0+1+0+0+0+0+0
Wednesday: 0+0+1+0+0+0+0

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


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.