The SASEHAVR Interface Engine

Example 42.13 Selecting Variables Based on Geography Key Codes

Since the haverd database did not have interesting geography codes, the following statements access the INTWKLY database by using its more complete geography key codes to select the desired time series from the specified geography codes:


Libname lib1 sasehavr "%sysget(HAVER_DATA_NEW)"
        outselect=on
   keep="R273RF3,X924USBE,R023DF,R273G1,F023A,F158FBS,F023ACR,X156VEB,F023ACE";

data valid1(keep=NAME SOURCE GEOG1 GEOG2 SHORTSRC LONGSRC);
   set lib1.intwkly;
run;

title1 'OUTSELECT=ON, Print the OUT= Data Set';
title2 'Shows the Values for Key Selection Variables:';
title3 'Name, Source, Geog1, Geog2, Shortsrc, Longsrc';
title4 'OUTSELECT=ON, the CONTENTS Procedure with Variable Names and Labels';
proc print data=valid1;
run;

Libname lib2 sasehavr "%sysget(HAVER_DATA_NEW)"
   geog1="156";

data valid2(
   keep=date R273RF3 X924USBE R023DF R273G1 F023A F158FBS F023ACR X156VEB F023ACE);
   set lib2.intwkly;
run;

title1 'Only one GEOG1 Code, 156, contains time series X156VEB';
title2 'Select Geography Code 1 Option:';
title3 'GEOG1= option';
title4 'Only Time Series X156VEB has Geog1 = 156';

proc contents
   data=valid2;
run;

Libname lib3 sasehavr "%sysget(HAVER_DATA_NEW)"
   geog2="299";

data valid3(
   keep=date R273RF3 X924USBE R023DF R273G1 F023A F158FBS F023ACR X156VEB F023ACE);
   set lib3.intwkly;
run;

title1 'Only one GEOG2 Code, 299, contains time series X156VEB';
title2 'Select Geography Code 2 Option:';
title3 'GEOG2= option';
title4 'Only Time Series X156VEB has Geog2 = 299';

proc contents
   data=valid3;
run;

title1 'Compare GEOG1 Code 156';
title2 'Over nonmissing values range';
title3 'With GEOG2 Code 299';
title4 'Over nonmissing values range';

proc compare listall briefsummary criterion=1.0e-5
   base=valid2(
   where=( date between '09jan1998'd and '28dec2007'd ))
   compare=valid3(
   where=( date between '09jan1998'd and '28dec2007'd ));
run;

Output 42.13.1, Output 42.13.2, Output 42.13.3, and Output 42.13.4 show the output.

Output 42.13.1: OUTSELECT=ON Option Shows the Values for Key Selection Variables

OUTSELECT=ON, Print the OUT= Data Set
Shows the Values for Key Selection Variables:
Name, Source, Geog1, Geog2, Shortsrc, Longsrc
OUTSELECT=ON, the CONTENTS Procedure with Variable Names and Labels

Obs NAME SOURCE GEOG1 GEOG2 SHORTSRC LONGSRC
1 NAME SOURCE GEOG1 GEOG2 SHORTSRC LONGSRC
2 F023A STLF 023   ECB European Central Bank
3 F023ACE STLF 023   ECB European Central Bank
4 F023ACR STLF 023   ECB European Central Bank
5 F158FBS --- 158   JMoF Ministry of Finance
6 R023DF --- 023   ECB European Central Bank
7 X156VEB STLF 156 299 BOCAN Bank of Canada
8 X924USBE STLF 924 111 SAFE China State Administration of Foreign Exchange


Output 42.13.2: Only One GEOG1 Code, 156, Contains Time Series X156VEB

Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
1 DATE Num 8 DATE9. Date of Observation
2 X156VEB Num 8   Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar)


Output 42.13.3: Only One GEOG2 Code, 299, Contains Time Series X156VEB

Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
1 DATE Num 8 DATE9. Date of Observation
2 X156VEB Num 8   Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar)


Output 42.13.4: Comparing GEOG1 and GEOG2 Access of INTWKLY Haver DLX Database

OUTSELECT=ON, Print the OUT= Data Set
Shows the Values for Key Selection Variables:
Name, Source, Geog1, Geog2, Shortsrc, Longsrc
OUTSELECT=ON, the CONTENTS Procedure with Variable Names and Labels

Obs NAME SOURCE GEOG1 GEOG2 SHORTSRC LONGSRC
1 NAME SOURCE GEOG1 GEOG2 SHORTSRC LONGSRC
2 F023A STLF 023   ECB European Central Bank
3 F023ACE STLF 023   ECB European Central Bank
4 F023ACR STLF 023   ECB European Central Bank
5 F158FBS --- 158   JMoF Ministry of Finance
6 R023DF --- 023   ECB European Central Bank
7 X156VEB STLF 156 299 BOCAN Bank of Canada
8 X924USBE STLF 924 111 SAFE China State Administration of Foreign Exchange

Only one GEOG1 Code, 156, contains time series X156VEB
Select Geography Code 1 Option:
GEOG1= option
Only Time Series X156VEB has Geog1 = 156

The CONTENTS Procedure

Data Set Name WORK.VALID2 Observations 2404
Member Type DATA Variables 2
Engine V9 Indexes 0
Created 10/29/2013 14:31:43 Observation Length 16
Last Modified 10/29/2013 14:31:43 Deleted Observations 0
Protection   Compressed NO
Data Set Type   Sorted NO
Label      
Data Representation WINDOWS_32    
Encoding wlatin1 Western (Windows)    

Engine/Host Dependent Information
Data Set Page Size 65536
Number of Data Set Pages 1
First Data Page 1
Max Obs per Page 4062
Obs in First Data Page 2404
Number of Data Set Repairs 0
ExtendObsCounter YES
Filename C:\DOCUME~1\saskff\LOCALS~1\Temp\SAS Temporary Files\_TD1152_VMW0296_\valid2.sas7bdat
Release Created 9.0401M1
Host Created XP_PRO

Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
1 DATE Num 8 DATE9. Date of Observation
2 X156VEB Num 8   Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar)

Only one GEOG2 Code, 299, contains time series X156VEB
Select Geography Code 2 Option:
GEOG2= option
Only Time Series X156VEB has Geog2 = 299

The CONTENTS Procedure

Data Set Name WORK.VALID3 Observations 682
Member Type DATA Variables 2
Engine V9 Indexes 0
Created 10/29/2013 14:38:32 Observation Length 16
Last Modified 10/29/2013 14:38:32 Deleted Observations 0
Protection   Compressed NO
Data Set Type   Sorted NO
Label      
Data Representation WINDOWS_32    
Encoding wlatin1 Western (Windows)    

Engine/Host Dependent Information
Data Set Page Size 65536
Number of Data Set Pages 1
First Data Page 1
Max Obs per Page 4062
Obs in First Data Page 682
Number of Data Set Repairs 0
ExtendObsCounter YES
Filename C:\DOCUME~1\saskff\LOCALS~1\Temp\SAS Temporary Files\_TD1152_VMW0296_\valid3.sas7bdat
Release Created 9.0401M1
Host Created XP_PRO

Alphabetic List of Variables and Attributes
# Variable Type Len Format Label
1 DATE Num 8 DATE9. Date of Observation
2 X156VEB Num 8   Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar)

Compare GEOG1 Code 156
Over nonmissing values range
With GEOG2 Code 299
Over nonmissing values range

                             The COMPARE Procedure                              
                   Comparison of WORK.VALID2 with WORK.VALID3                   
                 (Method=RELATIVE(2.22E-09), Criterion=0.00001)                 
                                                                                
NOTE: No unequal values were found. All values compared are exactly equal.