More on the f CommandΒΆ

One of the strengths of G7 is its capacity to create new data series as transformations of already-defined series. You create a new series in G7 by using the “f” command that was introduced above. The “f” command also can be used to create new timeseries where new series are the on the left side of an equal sign and functions of previously-defined variables are on the right. For example, to form the ratio of government consumption and investment to nominal GDP, you would:

  • Decide on a name for the new variable. We’ll call this one “govshare”.

  • Find the names for government consumption and investment and GDP, and create aliases in the workspace bank if you like. You can get these names by using look. Copy n01n01 as gdp and n01n20 as govt.

  • Type the following equation:

    f gdp = n01n01
    f govt = n01n20
    f govshare = govt/gdp
    

Now that govshare has been calculated, look at the results. Type:

ty govshare

To graph govshare, simply type:

ti Government share of GDP
gr govshare

To create a vertical axis title for your graph, use:

vaxti Billions of Dollars

Previous topic

The G7 Command Box and Button Bar

Next topic

Running G7 Commands in Batch (Add files)

This Page