Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The DATASOURCE Procedure

Reading in Data Files Containing Cross Sections

Some data files group time series data with respect to cross-section identifiers; for example, International Financial Statistics files, distributed by IMF, group data with respect to countries (COUNTRY). Within each country, data are further grouped by Control Source Code (CSC), Partner Country Code (PARTNER), and Version Code (VERSION).

If a data file contains cross-section identifiers, the DATASOURCE procedure adds them to the output data set as BY variables. For example, the data set in Table 10.1 contains three cross sections:

Table 10.1: The Form of a SAS Data Set Containing BY Variables
BY Time ID Time Series
Variables Variable Variables
COUNTRYCSCPARTNERVERSIONDATEEFFEXREXRINDEX
112F ZSEP1987932612685
112F ZOCT1987939312813
112F ZNOV1987962613694
112F ZDEC1987967514099
112F ZJAN1988958113910
112F ZFEB1988949313549
146F ZSEP19871204616192
146F ZOCT19871206716266
146F ZNOV19871255817596
146F ZDEC19871275918301
146F ZJAN19881264218082
146F ZFEB19881240917470
158F ZSEP19871384116558
158F ZOCT19871375416499
158F ZNOV19871422217505
158F ZDEC19871476818423
158F ZJAN19881493318565
158F ZFEB19881491518331

Note that the data sets in Figure 10.1 and Table 10.1 are two different ways of representing the same data, namely foreign exchange rates for three different countries: the United Kingdom (COUNTRY='112'), Switzerland (COUNTRY='146') and Japan (COUNTRY='158'). The first representation ( Figure 10.1) incorporates country names into the series names, while the second representation ( Table 10.1) represents countries as different cross sections. See "Time Series and SAS Data Sets" in Chapter 2, "Working with Time Series Data,".

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.