Unstack workfile page (convert repeated observations to repeated series).
Create a new workfile page by taking series objects (series, alphas, or links) in the default workfile page and breaking them into multiple series (or alphas), one for each distinct value found in a user supplied list of series objects. Typically used on a page with a panel structure.
Syntax
pageunstack(options) stack_id obs_id [@ series_to_unstack]
where stack_id is a single series containing the unstacking ID values used to identify the individual unstacked series, obs_id is a series containing the observation IDs, and series_to_unstack is an optional list of series objects to be copied to the new workfile.
Options
namepat =name_pattern | Specifies the pattern from which unstacked series names are constructed, where “*” indicates the original series name and “?” indicates the stack ID. By default the name_pattern is “*?”, indicating, for example, that if we have the IDs “US”, “UK”, “JPN”, the unstacked series corresponding to the series GDP should be named “GDPUS”, “GDPUK”, “GDPJPN” in the unstacked workfile page. |
wf=wf_name | Optional name for the new workfile. If not provided, EViews will create a new page in the default workfile. |
page=page_name | Optional name for the newly created page. If not provided, EViews will use the next available name of the form “Untitled##”, where ## is a number. |
Examples
Consider a workfile that contains the series GDP and CONS which contain the values of Gross Domestic Product and consumption for three countries stacked on top of each other. Suppose further there is an alpha object called COUNTRY containing the observations “US”, “UK”, and “JPN”, which identify which from which country each observation of GDP and CONS comes. Finally, suppose there is a date series DATEID which identifies the date for each observation. The command:
pageunstack country dateid @ gdp cons
creates a new workfile page using the workfile frequency and dates found in DATEID. The page will contain the 6 series GDPUS, GDPUK, GDPJPN, CONSUS, CONSUK, and CONSJPN corresponding to the unstacked GDP and CONS.
Typically the source workfile described above would be structured as a dated panel with the cross-section ID series COUNTRY and the date ID series DATEID. Since the panel has built-in date information, we may use the “@DATE” keyword as the DATEID. The command:
pageunstack country @date @ gdp cons
uses the date portion of the current workfile structure to identify the dates for the unstacked page.
The stack_id must be an ordinary, or an alpha series that uniquely identifies the groupings to use in unstacking the series. obs_id may be one or more ordinary series or alpha series, the combination of which uniquely identify each observation in the new workfile.
You may provide an explicit list of series to unstack following an “@” immediately after the obs_id. Wildcards may be used in this list. For example:
pageunstack country dateid @ g* c*
unstacks all series and alphas that have names that begin with “G” or “C’.
If no series_to_unstack list is provided, all series in the source workfile will be unstacked. Thus, the two commands:
pageunstack country dateid @ *
pageunstack country dateid
are equivalent.
By default, series are named in the destination workfile page by appending the stack_id values to the original series name. Letting “*” stand for the original series name and “?” for the stack_id, names are constructed as “*?”. This default may be changed using the “namepat=” option. For example:
pageunstack(namepat="?_*") country dateid @ gdp cons
creates the series US_GDP, UK_GDP, JPN_GDP, etc.
Cross-references
For additional discussion and examples, see
“Unstacking a Workfile”.