The DATASOURCE Procedure

Example 12.5 DRI Data Delivery Service Database

This example demonstrates the DRIDDS filetype for the daily Federal Reserve Series fxrates_dds. Use VALIDVARNAME=ANY in your SAS options statement to allow special characters such as @, $, and % to be in the series name. Note the use of long variable names in the OUT= data set in Output 12.5.2 and long labels in the OUTCONT= data set in Output 12.5.1.

The following statements extract daily series starting in January 1,1997:

options validvarname=any;
filename datafile "%sysget(DATASRC_DATA)drifxrat.dat" RECFM=F LRECL=80;
proc format;
   value distekfm 0 = 'Unspecified'
                  2 = 'Linear'
                  4 = 'Triag'
                  6 = 'Polynomial'
                  8 = 'Even'
                 10 = 'Step'
                 12 = 'Stocklast'
                 14 = 'LinearUnadjusted'
                 16 = 'PolyUnadjusted'
                 18 = 'StockWithNAS'
                 99 = 'None'
                255 = 'None';

   value convtkfm 0 = 'Unspecified'
                  1 = 'Average'
                  3 = 'AverageX'
                  5 = 'Sum'
                  7 = 'SumAnn'
                  9 = 'StockEnd'
                 11 = 'StockBegin'
                 13 = 'AvgNP'
                 15 = 'MaxNP'
                 17 = 'MinNP'
                 19 = 'StockEndNP'
                 21 = 'StockBeginNP'
                 23 = 'Max'
                 25 = 'Min'
                 27 = 'AvgXNP'
                 29 = 'SumNP'
                 31 = 'SumAnnNP'
                 99 = 'None'
                255 = 'None';

 /*--------------------------------------------------------*
  *                 process daily series                   *
  *--------------------------------------------------------*/
title3 'Reading DAILY Federal Reserve Series with fxrates_.dds';
proc datasource filetype=dridds
                infile=datafile
                interval=day
                out=fixr
                outcont=fixrcnt
                outall=fixrall;
   keep rx: ;
   range from '01jan97'd to '31dec99'd;
   format disttek distekfm.;
   format convtek convtkfm.;
run;

title1 'CONTENTS of FXRATES_.DDS File, KEEP RX:';
proc print
   data=fixrcnt;
run;

title1 'Daily Series Available in FXRATES_.DDS File, KEEP RX:';
proc print
   data=fixr;
run;

Output 12.5.1: Listing of the OUTCONT=FIXRCNT Data Set for FILETYPE=DRIDDS

CONTENTS of FXRATES_.DDS File, KEEP RX:

Obs NAME KEPT SELECTED TYPE LENGTH VARNUM LABEL FORMAT FORMATL FORMATD SOURCEID DISTTEK CONVTEK STATUS UPDATE UPTIME
1 RXA$%US$@AU 1 1 1 5 2 EXCHANGE RATE IN AUSTRALIAN DOLLAR PER US DOLLAR - AUSTRALIA   0 0 @FACS/DATA.D Unspecified Unspecified 0 31JAN97 132605
2 RXBF%US$@BE 1 1 1 5 3 EXCHANGE RATE IN BELGIAN FRANCS PER US DOLLAR - BELGIUM   0 0 @FACS/DATA.D Unspecified Unspecified 0 31JAN97 132544
3 RXDK%US$@DK 1 1 1 5 4 EXCHANGE RATE IN DANISH KRONE PER 100 US DOLLAR - DENMARK   0 0 @FACS/DATA.D Unspecified Unspecified 0 31JAN97 132544


Output 12.5.2: Printout of the OUT=FIXR Data Set for FILETYPE=DRIDDS

Daily Series Available in FXRATES_.DDS File, KEEP RX:

Obs DATE RXA$%US$@AU RXBF%US$@BE RXDK%US$@DK
1 01JAN1997 1.26133 31.9200 5.92877
2 02JAN1997 1.26133 31.9200 5.92877
3 03JAN1997 1.26133 31.9200 5.92877
4 04JAN1997 1.27708 32.4620 6.01098
5 05JAN1997 1.27708 32.4620 6.01098
6 06JAN1997 1.27708 32.4620 6.01098
7 07JAN1997 1.27708 32.4620 6.01098
8 08JAN1997 1.27708 32.4620 6.01098
9 09JAN1997 1.27708 32.4620 6.01098
10 10JAN1997 1.27708 32.4620 6.01098
11 11JAN1997 1.28443 32.9360 6.09112
12 12JAN1997 1.28443 32.9360 6.09112
13 13JAN1997 1.28443 32.9360 6.09112
14 14JAN1997 1.28443 32.9360 6.09112
15 15JAN1997 1.28443 32.9360 6.09112
16 16JAN1997 1.28443 32.9360 6.09112
17 17JAN1997 1.28443 32.9360 6.09112
18 18JAN1997 1.29195 33.7500 6.24658
19 19JAN1997 1.29195 33.7500 6.24658
20 20JAN1997 1.29195 33.7500 6.24658
21 21JAN1997 1.29195 33.7500 6.24658
22 22JAN1997 1.29195 33.7500 6.24658
23 23JAN1997 1.29195 33.7500 6.24658
24 24JAN1997 1.29195 33.7500 6.24658
25 25JAN1997 1.30133 33.8974 6.27520
26 26JAN1997 1.30133 33.8974 6.27520
27 27JAN1997 1.30133 33.8974 6.27520
28 28JAN1997 1.30133 33.8974 6.27520
29 29JAN1997 1.30133 33.8974 6.27520
30 30JAN1997 1.30133 33.8974 6.27520
31 31JAN1997 1.30133 33.8974 6.27520