Creating a Vector of 1s; Multiplying by Value

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

LXWatson
Posts: 10
Joined: Mon Jun 24, 2013 12:09 pm

Creating a Vector of 1s; Multiplying by Value

Postby LXWatson » Tue Jun 25, 2013 7:31 am

Hello again,

Eviews 8

I'm trying to generate a vector of ones then multiply that vector by a value. The goal is to make it easier to create excel bar graphs.

I've tried a couple different ways of writing, but I most frequently get the error "Illegal lag or Index Specification"

My code:

vector(900) v1 = 1
genr LNS11324230_avg04_06v = (LNS11324230_avg2004_2006 * v1)
Last edited by LXWatson on Tue Jun 25, 2013 7:34 am, edited 1 time in total.

LXWatson
Posts: 10
Joined: Mon Jun 24, 2013 12:09 pm

Re: Creating a Vector of 1s; Multiplying by Value

Postby LXWatson » Tue Jun 25, 2013 7:34 am

I've also tried this version to no avail:

vector v2=@ones(900) ====> this is what the help page showed me
genr LNS11324230_avg09_13v = (LNS11324230_avg2009_2013*v2)

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

Re: Creating a Vector of 1s; Multiplying by Value

Postby EViews Gareth » Tue Jun 25, 2013 7:56 am

You're trying to multiply a series by a vector. This can't be done. You can only multiply a vector by a vector, or a series by a series (or either by a scalar).

Of course that leaves the obvious question as to why you're trying to create a series that is equal to another series multiplied by a vector of ones...

LXWatson
Posts: 10
Joined: Mon Jun 24, 2013 12:09 pm

Re: Creating a Vector of 1s; Multiplying by Value

Postby LXWatson » Tue Jun 25, 2013 8:13 am

Good point, I should have been clearer about my goals:

"LNS11324230_avg2009_2013" is a value and I wanted to create the vector of 1s so that I could turn the vector into a vector of that value. Then I can set excel to grab that last value of the exported column as it updates.

Would the following code work:

vector(900) v1 = LNS11324230_avg2009_2013

where the vector is set to that value?

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

Re: Creating a Vector of 1s; Multiplying by Value

Postby EViews Gareth » Tue Jun 25, 2013 8:22 am

yes

LXWatson
Posts: 10
Joined: Mon Jun 24, 2013 12:09 pm

Re: Creating a Vector of 1s; Multiplying by Value

Postby LXWatson » Tue Jun 25, 2013 9:43 am

EDIT: I am trying a new approach, so I no need to answer this if you've got other issues.

I think I am at my last hurdle. I inherited the start of the project from someone else's work, so the last line of the code I've never manipulated (just been able to copy paste as needed).

I get that "LNU01300012_avg04_06v" is not a series. This is true, it is a vector. I'm guessing the issue is that my vector can't be placed were I've placed it, but I don't know how to get it to go to the excel.

Here is a sample of what I have:

Smpl %first %last
vector(1000) LNU01300012_avg04_06v = LNU01300012_avg2004_2006
wfsave(type=excelxml, mode=update) %outputfile1 range="Sheet16" @keep LNU01300012 LNU01300012_avg04_06v LNU01300012_avg09_13v @smpl %last %last

Thank you

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

Re: Creating a Vector of 1s; Multiplying by Value

Postby EViews Gareth » Tue Jun 25, 2013 9:56 am

I think you're mixing vectors and series again. WFSAVE lets you save the series in your workfile.

Is there a reason you're using vectors?


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests