Previous Page | Next Page

The SASEHAVR Interface Engine

Example 37.8 Using the KEEP Option to Subset Time Series from a Haver Database

To select specific time series, you can use the KEEP= or DROP= option as follows.

libname lib1 sasehavr "%sysget(HAVER_DATA)" 
        freq=daily 
        start=20041101 
        end=20041231 
        keep="FCM*";

data hwoutd;
   set lib1.haverd;
run;

title1 'Haver Analytics Database, Frequency=daily, infile=haverd.dat';
title2 '   Define a range inside the data range for OUT= dataset';        
title3 '   Using the START=20041101 END=20041231 LIBNAME options.';       
title4 '   Subset further: Using keep="FCM*" LIBNAME option ';            
proc print data=hwoutd;
run;

Output 37.8.1 shows two series that are selected by using KEEP="FCM*" in the LIBNAME statement.

Output 37.8.1 Using the KEEP Option and Defining a Range Using START=20041101 END=20041231
Haver Analytics Database, Frequency=daily, infile=haverd.dat
Define a range inside the data range for OUT= dataset
Using the START=20041101 END=20041231 LIBNAME options.
Subset further: Using keep="FCM*" LIBNAME option

Obs DATE FCM10 FCM1M
1 01NOV2004 4.11 1.79
2 02NOV2004 4.10 1.86
3 03NOV2004 4.09 1.83
4 04NOV2004 4.10 1.85
5 05NOV2004 4.21 1.86
6 08NOV2004 4.22 1.88
7 09NOV2004 4.22 1.89
8 10NOV2004 4.25 1.88
9 11NOV2004 . .
10 12NOV2004 4.20 1.91
11 15NOV2004 4.20 1.92
12 16NOV2004 4.21 1.93
13 17NOV2004 4.14 1.90
14 18NOV2004 4.12 1.91
15 19NOV2004 4.20 1.98
16 22NOV2004 4.18 1.98
17 23NOV2004 4.19 1.99
18 24NOV2004 4.20 1.98
19 25NOV2004 . .
20 26NOV2004 4.24 2.01
21 29NOV2004 4.34 2.02
22 30NOV2004 4.36 2.07
23 01DEC2004 4.38 2.06
24 02DEC2004 4.40 2.06
25 03DEC2004 4.27 2.06
26 06DEC2004 4.24 2.09
27 07DEC2004 4.23 2.08
28 08DEC2004 4.14 2.08
29 09DEC2004 4.19 2.07
30 10DEC2004 4.16 2.07
31 13DEC2004 4.16 2.04
32 14DEC2004 4.14 2.01
33 15DEC2004 4.09 1.98
34 16DEC2004 4.19 1.93
35 17DEC2004 4.21 1.95
36 20DEC2004 4.21 1.97
37 21DEC2004 4.18 1.92
38 22DEC2004 4.21 1.84
39 23DEC2004 4.23 1.83
40 24DEC2004 . .
41 27DEC2004 4.30 1.90
42 28DEC2004 4.31 1.88
43 29DEC2004 4.33 1.76
44 30DEC2004 4.27 1.68
45 31DEC2004 4.24 1.89

You can use the DROP option to drop specific variables from a Haver database. To specify this option, use DROP= instead of KEEP=.

Previous Page | Next Page | Top of Page