How to create month dummy variable automatically?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

How to create month dummy variable automatically?

Postby gansuld » Thu Jun 26, 2014 6:34 pm

I have a variable with name which includes year, month, day, but these three (year, month, day) are just one category. In that case, how to create month dummy variable automatically? What more, my variable takes the values of 2013-01-13, 2014-01-13, and so on. Hence, I am only interested month dummy variable.
Last edited by gansuld on Thu Jun 26, 2014 6:46 pm, edited 1 time in total.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to create month dummy variable automatically?

Postby EViews Gareth » Thu Jun 26, 2014 6:44 pm

Is your work file structured by that variable?

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

Re: How to create month dummy variable automatically?

Postby gansuld » Thu Jun 26, 2014 6:58 pm

My data is pooled cross section. I mean, my data is by month in 2013, 2014. I have entered the data in Eviews as unstructured working file.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13584
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to create month dummy variable automatically?

Postby EViews Gareth » Thu Jun 26, 2014 7:49 pm

Post the workfike

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

Re: How to create month dummy variable automatically?

Postby gansuld » Thu Jun 26, 2014 7:57 pm

It is my working file.
Attachments
00_my data.wf1
(552.14 KiB) Downloaded 403 times

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

Re: How to create month dummy variable automatically?

Postby gansuld » Thu Jun 26, 2014 8:00 pm

I have 17 months. I want to create month dummy variables automatically using date?

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: How to create month dummy variable automatically?

Postby startz » Thu Jun 26, 2014 8:22 pm

Code: Select all

series month=@datepart(date,"mm") series d1=month=1

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

Re: How to create month dummy variable automatically?

Postby gansuld » Thu Jun 26, 2014 9:17 pm

Thank you very much. I used this command. However, I have one problem. I created the variable is d1, but for the d1, "2013-01" and "2014-01" are the same values. In my case, 2013-01 and 2014-01 are different values. I mean 2014-01 should equal to 13, 2014-02 should equal to 14, and so on. Help me...

startz
Non-normality and collinearity are NOT problems!
Posts: 3796
Joined: Wed Sep 17, 2008 2:25 pm

Re: How to create month dummy variable automatically?

Postby startz » Fri Jun 27, 2014 5:11 am

Something like

Code: Select all

series month=@datepart(date,"mm") series year=@datepart(date,"yyyy") series distinctMonth = month+ year-2013 series d1=distinctMonth =1

gansuld
Posts: 9
Joined: Thu Jun 26, 2014 6:23 pm

Re: How to create month dummy variable automatically?

Postby gansuld » Sun Jun 29, 2014 7:13 pm

Thanks a million!!! Again, I have one question. How to change a value of variable in eviews automatically?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests