Inserting sample string in @mean

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

bobshackleton
Posts: 25
Joined: Wed Mar 23, 2011 6:50 am

Inserting sample string in @mean

Postby bobshackleton » Wed Apr 20, 2011 6:42 am

Could someone explain what the problem is with this code:

Code: Select all

%sample_string = @str({%date_project_begin}) + " " + _ @str({%date_project_bbox_end}) scalar mean_inventory_change = @mean(dbbinv, %sample_string)
As far as I can see

Code: Select all

%sample_string
is inserting two years and a space enclosed by quotations (i.e. "2010 2021"), which is what I think the coding should specify.

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

Re: Inserting sample string in @mean

Postby EViews Gareth » Wed Apr 20, 2011 9:03 am

The manual is somewhat misleading on this. The @mean function only accepts a sample string if you are assigning into a series. If you are assigning into a scalar or a matrix, you can not include a sample string. Yes this is odd.

The simplest work around is to set the workfile sample before calculating the mean:

Code: Select all

%sample_string = @str({%date_project_begin}) + " " + @str({%date_project_bbox_end}) smpl {%sample_string} scalar mean_inventory_change = @mean(dbbinv) smpl @all

bobshackleton
Posts: 25
Joined: Wed Mar 23, 2011 6:50 am

Re: Inserting sample string in @mean

Postby bobshackleton » Wed Apr 20, 2011 10:38 am

OK thanks!


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests