- Extending with formula
- What is the difference between ExtendLinear and LinearExtend?
- Joining with formula
- Extending with Conversion settings' Partial Period
- Extending with Forecast analysis

**Extending with formula**

You can extend a series with its last value or with a specific value.

### Extend with last value to the end of a period

The following formulas, which you can type into the Series list, will extend the input series to the end of the corresponding period:

ExtendToEndOfMonth(series) ExtendToEndOfQuarter(series) ExtendToEndOfYear(series)

If you want to mark the extended values as forecasts, use:

ExtendLastAsForecast(series)

### Extend with another value to a specified date

Using the formula below, you can customize what value is used and until when the series is extended.

Extend(series, observation, number)

It can be translated as *Extend*(*which series, how far, which value*) and in order to work effectively you will need helper formulas like Last() or Endvalid(), for example:

Extend(uscpi, Last(EndOfYearAhead(0)), LastValid(uscpi))

will extend uscpi series to end of current year with its last value. While:

Extend(usrate0001, Endvalid(usrate0001)+Monthslength(2), 0.75)

will extend series usrate0001 and will put 0.75 value two months from its end. Observations between end of series and new point will be filled in automatically.

### Extend with YoY percentage

Below formula extends the series using the % YoY change to calculate a forecast for the whole calendar range. New values will be marked automatically as forecast.

ExtendLastYoYForecast(series)

This one has an additional parameter to point to the end of extending range.

ExtendLastYoYForecast(series, observation)

Here you can use same method with EndValid() as in previous example:

ExtendLastYoYForecast(series, endvalid(fx:s1)+Yearslength(6))

**What is the difference between ExtendLinear and LinearExtend?**

Both formulas, *ExtendLinear* and *LinearExtend*, are used to extend the series. With similar names and purpose, they can be easily confused but they extend the series in different way.

*ExtendLinear* uses linear interpolation to extend the series between the latest value and a manually specified value in the future, thus extending the series with a trend.

*LinearExtend* uses the Least-Square method to create a fitted line, which in turn is used to extend the series to a specified point in the future.

In below chart, you can see the difference between two methods of extending the series:

The formulas here are:

ExtendLinear(plgdp, Endvalid(plgdp)+Yearslength(4), 2900000000000) LinearExtended(plgdp, Endvalid(plgdp)+YearsLength(4))

**Joining with formula**

You can also extend one series with another. For that we have:

Join(series1, series2)

It can be translated as *Join(older series, newer series)*. After last value of series1 Macrobond will add values from series2 from the respective points in time. This can also be modified by third parameter which will point exactly where to connect series':

Join(series1, series2, Start(series2)) Join(series1, series2, Date(yyyy, mm, dd))

It can be translated as *Join(older series, newer series)*. After last value of series1 Macrobond will add values from series2 from the respective points in time.

### Joining series with more history

We also have special join formula for appending historical values before the start of series1:

JoinMoreHistory(series1, series2)

Unlike the standard Join formula this one translates to *Join(newer series, older series)*. It takes all observations of series1 and adds all values of series2 that are before the start of series1.

### Joining series with different scales

A good example of this is combining two series to make one with a longer total history. If these series have different scales, you should use one of the following formulas:

JoinScaled(series1, series2) JoinScaledAppend(series1, series2) JoinMoreHistoryScaled(series1, series2)

The difference between these formulas is the order of the series in the expression:

**JoinScaled **will join series2 at the end of series1.

**JoinMoreHistoryScaled** will add more history to series1 using the values of series2 that are before the start of series1.

For these formulas, a factor is applied to scale up the series:

**JoinScaled**: at the date of the junction, series1 is scaled to be equal to the value of series2. The rest of the values of series1 are then adjusted using the factor used at the date of the junction.

**JoinScaledAppend**: this works the same way but will scale the second time series instead of the first.

**JoinMoreHistoryScaled**: at the date of the junction, series2 is scaled to be equal to the value of series1. The rest of the values of series2 are then adjusted using the factor used at the date of the junction.

**Extending with Conversion settings' Partial Period**

If series is for example Monthly and you want to convert its frequency to Annual, you will not see value for a Year for which there is no 12 months of data. Incomplete periods are removed. In such situations use Conversion settings' 'Partial Periods to lower frequency method'. It will let you choose your preferred setting how to handle incomplete periods.

**Extending with Forecast analysis**

You can add forecast values to a raw time series in the Series list, or after having applied some calculations to it.

### Add a forecast in the beginning of the document

To add a forecast to the raw time series, before any calculations are made, click on Series list in the analysis tree. Open the tab called Forecasts and click Edit next to the series you'd like to add a forecast to.

Under 'Value preference' you can select which value (original or forecast) should appear when new original values will come in.

Please note that these forecasts will be added on the original frequency of the time series, even if the document uses another frequency.

### Add a forecast after calculations

To add the forecast after having applied some calculations to it, add the forecast as an analysis later in the analysis tree.