Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: How to Convert Nominal GDP to Real GDP

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: How to Convert Nominal GDP to Real GDP Date Fri, 21 Sep 2012 10:29:31 +0100

```My code was offered as a way to do it.

Nick

On Fri, Sep 21, 2012 at 10:24 AM, Lovisa Persson
> What I mean by cpi2001 etc is that you replace this with the actual values
> from your variable CPI from the year in question.
>
> If your variable CPI is in rate of change and the value for 2001 is 0.021
> and the value for 2002 is 0.025
> Then you will have
>
> Generate index=1
> replace index=1.021 if year==2001
> replace index=(1.021)*(1.025) if year==2002
>
> The index variable will then be:
> 1                        (at base year 2000)
> 1.021               (2001)
> 1.046525        (2002)
>
> Etc...
>
> This is what I would do, but there is maybe a more flashy way to do it.
>
> But if your CPI variable is already in index form, related to year 2000,
> there is no need....
>
> Lovisa
>
>
>
>
> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: den 21 september 2012 11:10
> To: statalist@hsphsun2.harvard.edu
> Subject: Re: st: How to Convert Nominal GDP to Real GDP
>
> I think you need to explain where the variables -cpi2001-, -cpi2002-, etc.
> come from in your solution.
>
> I guess that you are thinking in terms of subscripts, but writing otherwise.
>
> Perhaps you mean something more like
>
> gen index = 1
> replace index = index[_n-1] * (1 + cpi) if _n > 1
>
> Nick
>
> On Fri, Sep 21, 2012 at 9:44 AM, Lovisa Persson <lovisa.persson@nek.uu.se>
> wrote:
>
>> Is your variable CPI an index with value 100 or 1 at base year 2000?
>>
>> In that case you do what Lukas recommended.
>>
>> If the CPI is in rate of change from year to year,  you first need to
>> generate a price index variable with base year 2000 , and THEN you do
>> what the previous responder told you.
>>
>> generate index=1
>> replace index=1+cpi if year==2001
>>
>> and then you impute the rest of the values...
>>
>> replace index=(cpi2001+1)*(cpi2002+1) if year==2002 replace index=
>> (cpi2001+1)*(cpi2002+1)* (cpi2003+1) if year==2003
>>
>> You impute the actual values of the CPI in rate of change...
>>
>> Now you have an index which you can use to generate your Real GDP
> variable.
>> Using your nominal GDP variable and divide it by the index just as
>> described below.
>
> Lukas Borkowski
>
>> the answer would be -gen realgdp = gdp/cpi-
>
> Shawn Meyer:
>
>>> I am new user to Stata. I am requesting if you could teach me
>>> something
>> which sounds very simple. I have a panel data on GDP of over 100
>> countries for 10 years; from 2000 to 2010 with four variables id, year,
> GDP and CPI.
>> Now I want to generate a new variable REALGDP so that I get real GDP
>> for each country (id), with 2000 as the base year. Could you please
>> help me how to do it?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```