# [thelist] Compare Content in Multidimensional Array [PHP/SQL]

Stefan Schwarzer st.schwarzer at geois.de
Thu Sep 27 06:11:43 CDT 2007

```Sorry for any confusion...

the aim is to plot a line graph for a single country but for two or
three variables. Now, one could use two different y-axis (if there
are two data sets with different units); but it's not really the
right way to analyse data.

One should rather normalize them to a base year to enhance
comparisons. To achieve this, one would set the values for a specific
year to 1 (or 100) and put the other values of all variables in
relation to it.

Thus, taking two variables, say,

Fish Catch
- in Thousand Metric Tons
- data available for 1975 to 2005
and
Total Population
- in Million People
- data available for 1960 to 2005

Country is Kenya.

The "smallest common year" would be 1975. One needs thus to set the
values for that year to 1 (or 100), and calculate the other values of
the variables in respect to the needed factor.

Now the question is how to find that "smallest common year"
automatically, via SQL or PHP?

Thanks for any help!

Stef

On Sep 27, 2007, at 9:30 AM, Bojan Tesanovic wrote:

> Hi Stefan ,
> can you be more specific, it is not clear what you really want from
> PHP
> and some terms are confusing eg
>
> "So, the values for the country would be set to 100 based on the year
> 1975."  is there special logic for setting vales
>
> Also what does "smallest_common_year"  mean ?
>
> Here is how did I understood your problem
>
> ====
> 1.There is a table of countries with some data per year per country.
> 2. You would like to say , eg give me smallest statistical data for
> Afghanistan
> comparing from year 1975-2000 and 1960-2000
> ====
> or I am completely out of track.
> Can you just write the problem you need to solve with more specific
> data sample eg
>
>        name             2001    2002   2003   2004   2005
>   -----------------------------------------------------------------
>   Afghanistan            2.1      3.2   2.1     8.2   9
>   Albania                9.8      7.6   4.5     2.1   12.8
>
>
>
>
>
>
>
> Stefan Schwarzer wrote:
>> Hi there,
>>
>> I have some global national statistical data sets.
>>
>> The table design is like this for each variable:
>>
>>      name             2001    2002   2003   2004   2005
>> -----------------------------------------------------------------
>> Afghanistan    ....
>> Albania            ....
>>
>>
>> I would like to offer the possibility to compare two (or more)
>> variables for a given country. The data values need to be set to 100
>> at the first year which both variables have in common.
>>
>> So, one variable could have an annual vallues between 1960 and 2005;
>> another one only from 1975 to 2005.
>>
>> So, the values for the country would be set to 100 based on the year
>> 1975.
>>
>> In the moment I have a loop for the number of variables, selecting
>> all data and stocking them into an array:
>>
>>
>>             \$data[\$number_of_dataset][\$year] = \$value_of_that_year;
>>
>>
>> Probably there could be better approach in finding the
>> "smallest_common_year"?!
>>
>> If not, I wonder how, by using PHP, I can get that information...
>>
>> Can anyone give me a hint?
>>
>> Thank you very much!
>>
>> Stef
>>
>>
>>
>> ____________________________________________________________________
>>
>>    Stefan Schwarzer
>>
>>    Lean Back and Relax - Enjoy some Nature Photography: http://
>> photoblog.la-famille-schwarzer.de
>>
>>    Or: Appetite for Global Data? UNEP GEO Data Portal: http://
>> geodata.grid.unep.ch
>>
>> ____________________________________________________________________
>>
>>
>>
>
>
> --
> Bojan Tesanovic
> http://www.classicio.com/
> http://www.real-estates-sale.com/
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>

```