Page 1 of 1

Inserting sample string in @mean

Posted: Wed Apr 20, 2011 6:42 am
by bobshackleton
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.

Re: Inserting sample string in @mean

Posted: Wed Apr 20, 2011 9:03 am
by EViews Gareth
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

Re: Inserting sample string in @mean

Posted: Wed Apr 20, 2011 10:38 am
by bobshackleton
OK thanks!