• No results found

Adding two data les

You can add two Micro…t …les containing the same variables, or add the variables from one Micro…t …le to another.

To add two …les containing the same variables, select the ‘Add 2 Special Micro…t Files’ option from the File Menu. Choose the …rst …le, click OK, and then choose the second

Demo Version

For an academic or a commercial version

contact Oxford University Press

…le from the Open dialogue. If the …les contain the same variables, data frequency, or any number of undated observations, data are combined. The program appends the observations from the second data set to those of the …rst data set and, when observations can be ordered, sorts them.

To add two …les containing di¤erent variables but the same data frequency, load the …rst …le into Micro…t in the usual way. Then select ‘Add a Special Micro…t File to Workspace’ from the File Menu, and choose the …le you want to add to your existing …le from the Open dialogue.

If the data are incompatible, a warning message is displayed.

3.3.1 Adding two special Micro…t …les containing the same variables

Adding two data …les containing di¤erent observations on the same variables is particularly useful for extension and/or revision of data in either direction (backward or forward), and for stacking of undated (cross-sectional) data. In the case of …les containing dated and overlap- ping observations the second …le that you specify should contain the most recent information. The content of the …rst …le which overlaps with the second …le will be overwritten.

As an example suppose you have a special Micro…t …le (say, SET1.FIT) which contains annual observations for the period 1970-1978 on the variables, C, S, and Y .

Obs C S Y 1970 57814.0 0.0908 63585.0 1971 59724.0 0.0747 64544.0 1972 63270.0 0.0989 70214.0 1973 66332.0 0.1163 75059.0 1974 65049.0 0.1215 74049.0 1975 60000.0 0.1429 70000.0 1976 60000.0 0.1429 70000.0 1977 60000.0 0.1429 70000.0 1978 60000.0 0.1429 70000.0

Consider now a second special Micro…t …le called SET2.FIT which contains revised and updated observations on the same variables C, S, and Y over the period 1975 to 1980.

Obs C Y S 1975 64652.0 74005.0 0.1264 1976 64707.0 73437.0 0.1189 1977 64517.0 72288.0 0.1075 1978 68227.0 78259.0 0.1282 1979 71599.0 83666.0 0.1442 1980 17550.0 84771.0 0.1560

Using the ‘Add 2 Special Micro…t …les’option from the File Menu, and choosing SET1.FIT

Demo Version

For an academic or a commercial version

contact Oxford University Press

as …rst …le and SET2.FIT as second …le creates the following ‘combined’data set: Obs. C Y S 1970 57814.0 63585.0 0.0908 1971 59724.0 64544.0 0.0747 1972 63270.0 70214.0 0.0989 1973 66332.0 75059.0 0.1163 1974 65049.0 74049.0 0.1215 1975 64652.0 74005.0 0.1264 1976 64707.0 73437.0 0.1189 1977 64517.0 72288.0 0.1075 1978 68227.0 78259.0 0.1282 1979 71599.0 83666.0 0.1442 1980 71550.0 84771.0 0.1560

Notice that the observations for the period 1975-1978 in the …rst …le (SET1.FIT) which over- lap with the observations in the second …le (SET2.FIT) are overwritten by the corresponding observations in the second …le. Also note that the order of variables in the combined data set is the same as that of the second …le. Remember to save the combined data set as a special Micro…t …le!

In the case of data …les with non-overlapping observations, the data gaps (if any) will be shown by a blank …eld, indicating missing observations. For example, combining the …les

First File Obs X1 X2 1960 2.0 10.0 1961 3.0 20.0 1962 4.0 30.0 Second File Obs X1 X2 1965 10.0 25.0 1966 20.0 35.0 1967 22.0 45.0

produces the combined data set

Obs X1 X2 1960 2.0 10.0 1961 3.0 20.0 1962 4.0 30.0 1963 1964 1965 10.0 25.0 1966 20.0 35.0 1967 22.0 45.0

You can optionally …ll in the missing values in the Process window by means of the commands FILL_MISSING and FILL_FORWARD. See Chapter4on how to use these and other commands. In the case of data …les containing undated observations (cross- sectional data), the use of this option has the e¤ect of stacking the observations in the

Demo Version

For an academic or a commercial version

contact Oxford University Press

two special Micro…t …les. This facility is particularly useful for pooling cross-section and time series data. For example, combining the following two special Micro…t …les containing undated observations First File Obs P U P S 1 3.0 66.0 2 3.0 66.0 3 9.0 62.0 4 9.0 64.0 Second File Obs P U P S 1 16.0 71.0 2 25.0 64.0 3 24.0 64.0 4 22.0 64.0 5 12.0 70.0 6 13.0 66.0

results in the data set which appends the observations in the second …le at the end of the observations in the …rst …le.

Only Micro…t …les with the same data frequencies can be combined. For example, a data set containing annual observations cannot be combined with a data set containing quarterly or monthly observations.

3.3.2 Adding two special Micro…t …les containing di¤erent variables

Combining two …les containing di¤erent variables but the same data frequency allows you to add new variables to your current data set. The new variables should already have been stored in a special Micro…t …le.

When using this option the following points are worth bearing in mind:

1. The current data set and the special Micro…t …le to be added to it should have the same data frequencies, otherwise an error message will be displayed

2. The current data set and the special Micro…t …le need not cover the same time period

As an example, suppose your current data set contains

Obs X Y

1960 34.0000 76.0000 1961 25.0000 84.0000 1962 76.0000 90.0000

and you have a special Micro…t …le containing variables A and B over the period 1959 to 1963. The special Micro…t …le to be added to the current data set contains

Obs A B 1959 20.0000 72.0000 1960 40.0000 98.0000 1961 50.0000 76.0000 1962 30.0000 45.0000 1963 56.0000 87.0000

Demo Version

For an academic or a commercial version

contact Oxford University Press

If you now add the …les the above special Micro…t …le is added to your current data set, and your new current data set is

Obs X Y A B 1959 20.0000 72.0000 1960 34.0000 76.0000 40.0000 98.0000 1961 25.0000 84.0000 50.0000 76.0000 1962 76.0000 90.0000 30.0000 45.0000 1963 56.0000 87.0000

Note: If you wish to add variables to your data set from the keyboard, you should use the ADD command followed by the name of the variable in the Process window and then press to add the variable name to the workspace. Once the new variable is added to the workspace use the button to input values for the new variable just added to the workspace.