The SASEHAVR Interface Engine |
Example 35.10 Using the GROUP Option to Subset Time Series from a HAVER Database
To select specific variables that belong to a certain group, the GROUP= or DROPGROUP= option can also be used, similar to the way you use the KEEP= or DROP= option.
Output 35.10.1, Output 35.10.2, and Output 35.10.3 show 3 different cross sections of the same database, haverw, by specifying 3 unique GROUP= options: GROUP="F*" on LIBNAME lib1, GROUP="M*" on LIBNAME lib2, and GROUP="E*" on LIBNAME lib3.
libname lib1 sasehavr "%sysget(HAVER_DATA)"
freq=week.6
force=freq
start=20040102
end=20041001
group="F*";
data hwoutw;
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=hwoutw;
run;
Output 35.10.1
Using the GROUP=F* Option along with Defining a Range
02JAN2004 |
0.86 |
16.089 |
0.885 |
09JAN2004 |
0.88 |
12.757 |
0.920 |
16JAN2004 |
0.84 |
12.141 |
0.870 |
23JAN2004 |
0.79 |
12.593 |
0.875 |
30JAN2004 |
0.86 |
17.357 |
0.890 |
06FEB2004 |
0.90 |
21.759 |
0.920 |
13FEB2004 |
0.90 |
21.557 |
0.920 |
20FEB2004 |
0.92 |
21.580 |
0.915 |
27FEB2004 |
0.96 |
21.390 |
0.930 |
05MAR2004 |
0.97 |
24.119 |
0.940 |
12MAR2004 |
0.96 |
24.294 |
0.930 |
19MAR2004 |
0.94 |
23.334 |
0.945 |
26MAR2004 |
0.95 |
21.400 |
0.930 |
02APR2004 |
0.95 |
21.818 |
0.945 |
09APR2004 |
0.94 |
17.255 |
0.930 |
16APR2004 |
0.92 |
14.143 |
0.915 |
23APR2004 |
0.89 |
14.136 |
0.935 |
30APR2004 |
0.87 |
16.946 |
0.970 |
07MAY2004 |
0.89 |
22.772 |
0.985 |
14MAY2004 |
0.89 |
23.113 |
1.060 |
21MAY2004 |
0.91 |
25.407 |
1.040 |
28MAY2004 |
0.94 |
25.043 |
1.050 |
04JUN2004 |
0.97 |
27.847 |
1.130 |
11JUN2004 |
1.01 |
27.240 |
1.230 |
18JUN2004 |
1.05 |
17.969 |
1.390 |
25JUN2004 |
1.08 |
12.159 |
1.315 |
02JUL2004 |
1.11 |
12.547 |
1.355 |
09JUL2004 |
1.14 |
21.303 |
1.320 |
16JUL2004 |
1.16 |
25.024 |
1.315 |
23JUL2004 |
1.21 |
25.327 |
1.330 |
30JUL2004 |
1.30 |
21.823 |
1.425 |
06AUG2004 |
1.34 |
21.631 |
1.465 |
13AUG2004 |
1.37 |
28.237 |
1.470 |
20AUG2004 |
1.36 |
26.070 |
1.470 |
27AUG2004 |
1.39 |
27.342 |
1.515 |
03SEP2004 |
1.46 |
25.213 |
1.580 |
10SEP2004 |
1.57 |
25.255 |
1.635 |
17SEP2004 |
1.57 |
15.292 |
1.640 |
24SEP2004 |
1.56 |
15.068 |
1.685 |
01OCT2004 |
1.54 |
21.549 |
1.710 |
libname lib2 sasehavr "%sysget(HAVER_DATA)"
freq=week.6
force=freq start=20040102
end=20041001
group="M*";
data hwoutw;
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=hwoutw;
run;
Output 35.10.2
Using the GROUP=M* Option along with Defining a Range
02JAN2004 |
7302.9 |
1298.2 |
09JAN2004 |
7351.2 |
1294.3 |
16JAN2004 |
7378.5 |
1286.8 |
23JAN2004 |
7434.7 |
1296.7 |
30JAN2004 |
7492.4 |
1305.1 |
06FEB2004 |
7510.4 |
1303.1 |
13FEB2004 |
7577.8 |
1309.1 |
20FEB2004 |
7648.7 |
1317.0 |
27FEB2004 |
7530.6 |
1321.1 |
05MAR2004 |
7546.7 |
1316.2 |
12MAR2004 |
7602.0 |
1312.7 |
19MAR2004 |
7603.0 |
1324.0 |
26MAR2004 |
7625.5 |
1337.6 |
02APR2004 |
7637.3 |
1337.9 |
09APR2004 |
7667.4 |
1327.3 |
16APR2004 |
7692.5 |
1321.8 |
23APR2004 |
7698.4 |
1322.2 |
30APR2004 |
7703.8 |
1331.6 |
07MAY2004 |
7686.8 |
1342.5 |
14MAY2004 |
7734.6 |
1325.5 |
21MAY2004 |
7695.8 |
1330.1 |
28MAY2004 |
7704.7 |
1337.7 |
04JUN2004 |
7715.1 |
1329.0 |
11JUN2004 |
7754.0 |
1324.4 |
18JUN2004 |
7753.2 |
1336.4 |
25JUN2004 |
7796.2 |
1345.8 |
02JUL2004 |
7769.8 |
1351.4 |
09JUL2004 |
7852.3 |
1330.1 |
16JUL2004 |
7852.8 |
1326.3 |
23JUL2004 |
7854.7 |
1323.5 |
30JUL2004 |
7859.5 |
1340.6 |
06AUG2004 |
7847.9 |
1337.3 |
13AUG2004 |
7888.7 |
1340.1 |
20AUG2004 |
7851.8 |
1347.3 |
27AUG2004 |
7890.0 |
1360.8 |
03SEP2004 |
7906.2 |
1353.7 |
10SEP2004 |
7962.7 |
1338.3 |
17SEP2004 |
7982.1 |
1345.6 |
24SEP2004 |
7987.9 |
1359.7 |
01OCT2004 |
7949.5 |
1366.0 |
libname lib3 sasehavr "%sysget(HAVER_DATA)"
freq=week.6
force=freq
start=20040102
end=20041001
group="E*";
data hwoutw;
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=hwoutw;
run;
Output 35.10.3
Using the GROUP=E* Option along with Defining a Range
02JAN2004 |
552.8 |
09JAN2004 |
677.9 |
16JAN2004 |
490.8 |
23JAN2004 |
382.3 |
30JAN2004 |
406.3 |
06FEB2004 |
433.2 |
13FEB2004 |
341.6 |
20FEB2004 |
328.2 |
27FEB2004 |
342.1 |
05MAR2004 |
339.0 |
12MAR2004 |
312.1 |
19MAR2004 |
304.5 |
26MAR2004 |
296.8 |
02APR2004 |
304.2 |
09APR2004 |
350.7 |
16APR2004 |
335.0 |
23APR2004 |
313.7 |
30APR2004 |
283.2 |
07MAY2004 |
292.8 |
14MAY2004 |
297.1 |
21MAY2004 |
294.0 |
28MAY2004 |
304.1 |
04JUN2004 |
308.2 |
11JUN2004 |
312.4 |
18JUN2004 |
322.5 |
25JUN2004 |
318.7 |
02JUL2004 |
349.9 |
09JUL2004 |
444.5 |
16JUL2004 |
394.4 |
23JUL2004 |
315.7 |
30JUL2004 |
282.1 |
06AUG2004 |
291.5 |
13AUG2004 |
268.0 |
20AUG2004 |
272.1 |
27AUG2004 |
275.2 |
03SEP2004 |
273.7 |
10SEP2004 |
250.6 |
17SEP2004 |
275.8 |
24SEP2004 |
282.7 |
01OCT2004 |
279.6 |