Example 41.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 41.13.1, Output 41.13.2, Output 41.13.3, and Output 41.13.4 show the output.
Output 41.13.1
OUTSELECT=ON Option Shows the Values for Key Selection Variables
NAME |
SOURCE |
GEOG1 |
GEOG2 |
SHORTSRC |
LONGSRC |
F023A |
STLF |
023 |
|
ECB |
European Central Bank |
F023ACE |
STLF |
023 |
|
ECB |
European Central Bank |
F023ACR |
STLF |
023 |
|
ECB |
European Central Bank |
F158FBS |
--- |
158 |
|
JMoF |
Ministry of Finance |
R023DF |
--- |
023 |
|
ECB |
European Central Bank |
X156VEB |
STLF |
156 |
299 |
BOCAN |
Bank of Canada |
X924USBE |
STLF |
924 |
111 |
SAFE |
China State Administration of Foreign Exchange |
Output 41.13.2
Only One GEOG1 Code, 156, Contains Time Series X156VEB
DATE |
Num |
8 |
DATE9. |
Date of Observation |
X156VEB |
Num |
8 |
|
Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar) |
Output 41.13.3
Only One GEOG2 Code, 299, Contains Time Series X156VEB
DATE |
Num |
8 |
DATE9. |
Date of Observation |
X156VEB |
Num |
8 |
|
Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar) |
Output 41.13.4
Comparing GEOG1 and GEOG2 Access of INTWKLY Haver DLX Database
NAME |
SOURCE |
GEOG1 |
GEOG2 |
SHORTSRC |
LONGSRC |
F023A |
STLF |
023 |
|
ECB |
European Central Bank |
F023ACE |
STLF |
023 |
|
ECB |
European Central Bank |
F023ACR |
STLF |
023 |
|
ECB |
European Central Bank |
F158FBS |
--- |
158 |
|
JMoF |
Ministry of Finance |
R023DF |
--- |
023 |
|
ECB |
European Central Bank |
X156VEB |
STLF |
156 |
299 |
BOCAN |
Bank of Canada |
X924USBE |
STLF |
924 |
111 |
SAFE |
China State Administration of Foreign Exchange |
The CONTENTS Procedure
WORK.VALID2 |
2404 |
DATA |
2 |
V9 |
0 |
Thursday, April 09, 2009 03:35:56 PM |
16 |
Thursday, April 09, 2009 03:35:56 PM |
0 |
|
NO |
|
NO |
|
|
WINDOWS_32 |
|
wlatin1 Western (Windows) |
|
4096 |
10 |
1 |
252 |
172 |
0 |
C:\DOCUME~1\saskff\LOCALS~1\Temp\SAS Temporary Files\_TD3388\valid2.sas7bdat |
9.0202M2 |
XP_PRO |
DATE |
Num |
8 |
DATE9. |
Date of Observation |
X156VEB |
Num |
8 |
|
Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar) |
The CONTENTS Procedure
WORK.VALID3 |
682 |
DATA |
2 |
V9 |
0 |
Thursday, April 09, 2009 03:39:53 PM |
16 |
Thursday, April 09, 2009 03:39:53 PM |
0 |
|
NO |
|
NO |
|
|
WINDOWS_32 |
|
wlatin1 Western (Windows) |
|
4096 |
4 |
1 |
252 |
172 |
0 |
C:\DOCUME~1\saskff\LOCALS~1\Temp\SAS Temporary Files\_TD3388\valid3.sas7bdat |
9.0202M2 |
XP_PRO |
DATE |
Num |
8 |
DATE9. |
Date of Observation |
X156VEB |
Num |
8 |
|
Canada: Venezuelan Bolivar Noon Exchange Rate (C$/Bolivar) |
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.
|
Copyright © SAS Institute Inc. All rights reserved.