The SASEHAVR Interface Engine

Example 42.10 Using the GROUP Option to Subset Time Series from a Haver Database

You can use the GROUP= or DROPGROUP= option to select specific variables that belong to a certain group, similar to the way you use the KEEP= or DROP= option.

Output 42.10.1, Output 42.10.2, and Output 42.10.3 show three different cross sections of the same database, haverw, by specifying three unique GROUP= options: GROUP="F*" in LIBNAME LIB1, GROUP="M*" in LIBNAME LIB2, and GROUP="E*" in LIBNAME LIB3.

The following statements specify GROUP="F*" in the LIBNAME LIB1 statement:

libname lib1 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq 
        start=20040102 
        end=20041001 
        group="F*";

data hwoutwA;
   set lib1.haverw;
run;

title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';          
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';          
title4 '   Subset further: Using group="F*" LIBNAME option';              
proc print data=hwoutwA;
run;

Output 42.10.1 shows the output.

Output 42.10.1: Using the GROUP=F* Option and Defining a Range

Haver Analytics Database, Frequency=week.6, infile=haverw.dat
Define a range inside the data range for OUT= dataset
Using the START=20040102 END=20041001 LIBNAME options.
Subset further: Using group="F*" LIBNAME option

Obs DATE FCM1M FTA1MA FTB3
1 01JAN2004 0.86 16.089 0.885
2 08JAN2004 0.88 12.757 0.920
3 15JAN2004 0.84 12.141 0.870
4 22JAN2004 0.79 12.593 0.875
5 29JAN2004 0.86 17.357 0.890
6 05FEB2004 0.90 21.759 0.920
7 12FEB2004 0.90 21.557 0.920
8 19FEB2004 0.92 21.580 0.915
9 26FEB2004 0.96 21.390 0.930
10 04MAR2004 0.97 24.119 0.940
11 11MAR2004 0.96 24.294 0.930
12 18MAR2004 0.94 23.334 0.945
13 25MAR2004 0.95 21.400 0.930
14 01APR2004 0.95 21.818 0.945
15 08APR2004 0.94 17.255 0.930
16 15APR2004 0.92 14.143 0.915
17 22APR2004 0.89 14.136 0.935
18 29APR2004 0.87 16.946 0.970
19 06MAY2004 0.89 22.772 0.985
20 13MAY2004 0.89 23.113 1.060
21 20MAY2004 0.91 25.407 1.040
22 27MAY2004 0.94 25.043 1.050
23 03JUN2004 0.97 27.847 1.130
24 10JUN2004 1.01 27.240 1.230
25 17JUN2004 1.05 17.969 1.390
26 24JUN2004 1.08 12.159 1.315
27 01JUL2004 1.11 12.547 1.355
28 08JUL2004 1.14 21.303 1.320
29 15JUL2004 1.16 25.024 1.315
30 22JUL2004 1.21 25.327 1.330
31 29JUL2004 1.30 21.823 1.425
32 05AUG2004 1.34 21.631 1.465
33 12AUG2004 1.37 28.237 1.470
34 19AUG2004 1.36 26.070 1.470
35 26AUG2004 1.39 27.342 1.515
36 02SEP2004 1.46 25.213 1.580
37 09SEP2004 1.57 25.255 1.635
38 16SEP2004 1.57 15.292 1.640
39 23SEP2004 1.56 15.068 1.685
40 30SEP2004 1.54 21.549 1.710


The following statements specify GROUP="M*" in the LIBNAME LIB2 statement:


libname lib2 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq start=20040102 
        end=20041001 
        group="M*";
        
data hwoutwB;
   set lib2.haverw;
run;
  
title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';        
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';        
title4 '   Subset further: Using group="M*" LIBNAME option';            
proc print data=hwoutwB;
run;

Output 42.10.2 shows the output.

Output 42.10.2: Using the GROUP=M* Option and Defining a Range

Haver Analytics Database, Frequency=week.6, infile=haverw.dat
Define a range inside the data range for OUT= dataset
Using the START=20040102 END=20041001 LIBNAME options.
Subset further: Using group="M*" LIBNAME option

Obs DATE FA FM1
1 31DEC2003 7302.9 1298.2
2 07JAN2004 7351.2 1294.3
3 14JAN2004 7378.5 1286.8
4 21JAN2004 7434.7 1296.7
5 28JAN2004 7492.4 1305.1
6 04FEB2004 7510.4 1303.1
7 11FEB2004 7577.8 1309.1
8 18FEB2004 7648.7 1317.0
9 25FEB2004 7530.6 1321.1
10 03MAR2004 7546.7 1316.2
11 10MAR2004 7602.0 1312.7
12 17MAR2004 7603.0 1324.0
13 24MAR2004 7625.5 1337.6
14 31MAR2004 7637.3 1337.9
15 07APR2004 7667.4 1327.3
16 14APR2004 7692.5 1321.8
17 21APR2004 7698.4 1322.2
18 28APR2004 7703.8 1331.6
19 05MAY2004 7686.8 1342.5
20 12MAY2004 7734.6 1325.5
21 19MAY2004 7695.8 1330.1
22 26MAY2004 7704.7 1337.7
23 02JUN2004 7715.1 1329.0
24 09JUN2004 7754.0 1324.4
25 16JUN2004 7753.2 1336.4
26 23JUN2004 7796.2 1345.8
27 30JUN2004 7769.8 1351.4
28 07JUL2004 7852.3 1330.1
29 14JUL2004 7852.8 1326.3
30 21JUL2004 7854.7 1323.5
31 28JUL2004 7859.5 1340.6
32 04AUG2004 7847.9 1337.3
33 11AUG2004 7888.7 1340.1
34 18AUG2004 7851.8 1347.3
35 25AUG2004 7890.0 1360.8
36 01SEP2004 7906.2 1353.7
37 08SEP2004 7962.7 1338.3
38 15SEP2004 7982.1 1345.6
39 22SEP2004 7987.9 1359.7
40 29SEP2004 7949.5 1366.0


The following statements specify GROUP="E*" in the LIBNAME LIB3 statement:

libname lib3 sasehavr "%sysget(HAVER_DATA)"
        freq=week.6 
        force=freq 
        start=20040102 
        end=20041001 
        group="E*";

data hwoutwC;
   set lib3.haverw;
run;

title1 'Haver Analytics Database, Frequency=week.6, infile=haverw.dat';
title2 '   Define a range inside the data range for OUT= dataset';        
title3 '   Using the START=20040102 END=20041001 LIBNAME options.';        
title4 '   Subset further: Using group="E*" LIBNAME option';            
proc print data=hwoutwC;
run;

Output 42.10.3 shows the output.

Output 42.10.3: Using the GROUP=E* Option and Defining a Range

Haver Analytics Database, Frequency=week.6, infile=haverw.dat
Define a range inside the data range for OUT= dataset
Using the START=20040102 END=20041001 LIBNAME options.
Subset further: Using group="E*" LIBNAME option

Obs DATE LICN
1 02JAN2004 552.8
2 09JAN2004 677.9
3 16JAN2004 490.8
4 23JAN2004 382.3
5 30JAN2004 406.3
6 06FEB2004 433.2
7 13FEB2004 341.6
8 20FEB2004 328.2
9 27FEB2004 342.1
10 05MAR2004 339.0
11 12MAR2004 312.1
12 19MAR2004 304.5
13 26MAR2004 296.8
14 02APR2004 304.2
15 09APR2004 350.7
16 16APR2004 335.0
17 23APR2004 313.7
18 30APR2004 283.2
19 07MAY2004 292.8
20 14MAY2004 297.1
21 21MAY2004 294.0
22 28MAY2004 304.1
23 04JUN2004 308.2
24 11JUN2004 312.4
25 18JUN2004 322.5
26 25JUN2004 318.7
27 02JUL2004 349.9
28 09JUL2004 444.5
29 16JUL2004 394.4
30 23JUL2004 315.7
31 30JUL2004 282.1
32 06AUG2004 291.5
33 13AUG2004 268.0
34 20AUG2004 272.1
35 27AUG2004 275.2
36 03SEP2004 273.7
37 10SEP2004 250.6
38 17SEP2004 275.8
39 24SEP2004 282.7
40 01OCT2004 279.6