This document describes the Euro Package, which is being made available first to users of Version 6 of the SAS System.
The Euro package consists of informats, formats, and a function to handle the Euro.
The following are provided with this package:
EUROw.d format
EUROXw.d format
EUROw.d informat
EUROXw.d informat
EURFRxxxw.d formats:
EURFRATSw.d - convert to Euro from Austrian schilling
EURFRBEFw.d - convert to Euro from Belgian franc
EURFRFIMw.d - convert to Euro from Finnish markka
EURFRFRFw.d - convert to Euro from French franc
EURFRDEMw.d - convert to Euro from Deutsche mark
EURFRIEPw.d - convert to Euro from Irish pound
EURFRITLw.d - convert to Euro from Italian lira
EURFRLUFw.d - convert to Euro from Luxembourg franc
EURFRNLGw.d - convert to Euro from Dutch guilder
EURFRPTEw.d - convert to Euro from Portuguese escudo
EURFRESPw.d - convert to Euro from Spanish peseta
EURFRCHFw.d - convert to Euro from Swiss franc
EURFRDKKw.d - convert to Euro from Danish krone
EURFRGBPw.d - convert to Euro from British pound sterling
EURFRGRDw.d - convert to Euro from Greek drachma
EURFRSEKw.d - convert to Euro from Swedish krona
EURFRCZKw.d - convert to Euro from Czech koruna
EURFRHUFw.d - convert to Euro from Hungarian forint
EURFRNOKw.d - convert to Euro from Norwegian krone
EURFRRURw.d - convert to Euro from Russian ruble
EURFRTRLw.d - convert to Euro from Turkish lira
EURFRPLZw.d - convert to Euro from Polish zloty
EURFRROLw.d - convert to Euro from Romanian leu
EURFRYUDw.d - convert to Euro from Yugoslavian dinar
EURFRSITw.d - convert to Euro from Slovenian tolar
EURTOxxxw.d formats:
EURTOATSw.d - convert from Euro to Austrian schilling
EURTOBEFw.d - convert from Euro to Belgian franc
EURTOFIMw.d - convert from Euro to Finnish markka
EURTOFRFw.d - convert from Euro to French franc
EURTODEMw.d - convert from Euro to Deutsche mark
EURTOIEPw.d - convert from Euro to Irish pound
EURTOITLw.d - convert from Euro to Italian lira
EURTOLUFw.d - convert from Euro to Luxembourg franc
EURTONLGw.d - convert from Euro to Dutch guilder
EURTOPTEw.d - convert from Euro to Portuguese escudo
EURTOESPw.d - convert from Euro to Spanish peseta
EURTOCHFw.d - convert from Euro to Swiss franc
EURTODKKw.d - convert from Euro to Danish krone
EURTOGBPw.d - convert from Euro to British pound sterling
EURTOGRDw.d - convert from Euro to Greek drachma
EURTOSEKw.d - convert from Euro to Swedish krona
EURTOCZKw.d - convert from Euro to Czech koruna
EURTOHUFw.d - convert from Euro to Hungarian forint
EURTONOKw.d - convert from Euro to Norwegian krone
EURTORURw.d - convert from Euro to Russian ruble
EURTOTRLw.d - convert from Euro to Turkish lira
EURTOPLZw.d - convert from Euro to Polish zloty
EURTOROLw.d - convert from Euro to Romanian leu
EURTOYUDw.d - convert from Euro to Yugoslavian dinar
EURTOSITw.d - convert from Euro to Slovenian tolar
EUROCURR function
Each of the informats/formats/functions named above are described in their own section below.
The EUROw.d format will format a value that is presumed to be an amount in Euros. It will format exactly the same way as the DOLLARw.d format, except that the Euro symbol will be used instead of the $ symbol. The EUROXw.d format operates just like the DOLLARX format, except that the Euro symbol will be used instead of the $ symbol. If the d value of EUROw.d or EUROXw.d is unspecified, it is assumed to be 0 (for example, EURO5.0 and EURO5. are equivalent). See the section EURO SYMBOL below for a description on determining the Euro symbol.
Note that the DOLLARw.d and DOLLARXw.d formats allow d values of only 0 and 2 in Version 6, but starting in Version 7, any value of d between 0 and 11 is permitted, as long as it is at least 2 less than the w value.
Assume that the Euro symbol is 'E'.
data _null_;
input x @@;
put '*' x euro5. '*' x eurox5. '*' x euro9.2 '*' x eurox9.2 '*';
datalines;
1 1234.56 12345
;
produces
* E1* E1* E1.00* E1,00* *1,235*1.235*E1,234.56*E1.234,56* *12345*12345*12,345.00*12.345,00*
Note that when the value of 12345 is formatted using EURO5., the Euro symbol is not seen, because there is not enough room for the symbol. Be sure to leave room when deciding the width to use.
Note that Ireland and Great Britain tend to use the EUROw.d format, while most other European countries tend to use EUROXw.d.
The EUROw.d informat operates just like the DOLLARw.d informat, except that a Euro symbol is acceptable instead of a $ sign. Note that the Euro symbol is not required. If commas appear, they are ignored. If a dot appears, it is assumed to be a separator between the whole number and the decimal portion.
The EUROXw.d informat operates just like the DOLLARXw.d informat, except that a Euro symbol is acceptable instead of a $ sign. Note that the Euro symbol is not required. If dots appear, they are ignored. If a comma appears, it is assumed to separate the whole number from the decimal portion.
Assume that the Euro symbol is E.
data _null_;
input x euro10.; put x=; datalines;
E1
E1.23
1.23
1,234.56
run;
produces
X=1 X=1.23 X=1.23 X=1234.56
Consider how the sample differs with the EUROXw.d informat when the same results are to be derived.
data _null_;
input x eurox10.; put x=; datalines;
E1
E1,23
1,23
1.234,56
run;
produces
X=1 X=1.23 X=1.23 X=1234.56
Note that the EUROw.d and EUROXw.d informats are not always interchangeable, because they interpret commas and dots differently. If no commas or dots appear in the input, they are indeed interchangeable.
The series of formats listed above with the names EURFRxxxw.d (where xxx is a currency code) will convert from a specific currency value into Euros and produce a formatted Euro value equivalent to what the EUROXw.d or EUROw.d format produces. The conversion rate is obtained using the process described in the CONVERSION RATES section below.
Assume that 1 Swiss franc (CHF) converts to 3 Euros (EUR):
data _null_;
input x @@;
put '*' x eurfrchf5. '*' x eurfrchf9.2 '*';
datalines;
1 1234.56 12345
;
produces
* E3* E3,00* *3.704*E3.703,68* *37035*37.035,00*
Note that EURFRIEPw.d (from Irish pound to Euro) and EURFRGBP (British pound to Euro) will effectively format using the EUROw.d format instead of EUROXw.d.
For example, assume that 1 British pound converts to 3 Euros (EUR):
data _null_;
input x @@;
put '*' x eurfrgbp5. '*' x eurfrgbp9.2 '*';
datalines;
1 1234.56 12345
;
produces
* E3* E3.00* *3,704*E3,703.68* *37035*37,035.00*
Note how this output differs from the Swiss franc example above, where the roles of the commas and dots are reversed.
The series of formats listed above with the names EURTOxxxw.d (where xxx is a currency code) will convert to a specific currency value from Euros and produce a formatted value equivalent to the w.d format. The conversion rate is obtained using the process described in the CONVERSION RATES section below.
Assume that 1 Swiss franc (CHF) converts to 3 Euros (EUR):
data _null_;
input x @@;
put '*' x eurtochf5. '*' x eurtochf9.2 '*';
datalines;
1 1234.56 12345
;
produces
* 0* 0.33* * 412* 411.52* * 4115* 4115.00*
Note that the reason that we see '0' in the first example is because .33 Euros are less than .5, and so the value rounds down. Keep this in mind when deciding on providing no decimal places with conversions.
The EUROCURR function is used to convert from one currency to another. The syntax is as follows:
to_curr_amount = EUROCURR(from_curr_amount,from_curr,to_curr);
where
from_curr and to_curr are the 3-character currency codes (case insensitive). See CURRENCY CODES below for a list of possible values. A blank value for from_curr means to convert from Euros. Likewise, a blank value for to_curr means to convert to Euros.
If neither from_curr nor to_curr are 'EUR' (Euro), the triangular method of from_curr->EURO->to_curr is used.
This first example demonstrates converting 1 Deutsche mark to Euros.
data _null_; x=eurocurr(1,'dem','eur'); put x=;run;
The result is
X=0.5112918812
Compare this with the EURFRDEM format, which displays the converted amount:
data _null_; x=1; put x=eurfrdem8.6; run;
produces
X=0,511292
The difference is that the EUROCURR function produces a numeric value, while the EURFRDEM format produces a printable value,
This example demonstrates converting from Euro to marks:
data _null_; x=eurocurr(1,'eur','dem'); put x=;run;
produces
X=1.95583
Compare this with this example using the EURTODEM format:
X=1.955830
This example uses two currencies whose rates were fixed as of 01JAN1999: Deutsche marks and French francs. The franc rate was fixed at 6.55957 and the mark rate was set at 1.95583 on 01JAN1999. This means that 1 Euro is worth 6.55957 francs and 1.95583 marks. Keeping these rates in mind, consider the following DATA step:
data _null_; x=50; y=eurocurr(x,'frf','dem'); put y=; run;
We want to convert 50 francs into the proper number of marks. The EUROCURR function will convert between currencies by using the proper triangulation method. This method is to divide by the first currency rate and then multiply by the second. In our example, we divide 50 by the 6.55957 rate, then multiply that result by the mark rate of 1.95583. The value of Y is displayed as
y=14.908218069
which is (50 / 6.55957) * 1.95583.
Note that the intermediate value is stored in as much precision as is allowed on the platform using floating point arithmetic. No rounding takes place.
All the formats listed above will need to retrieve the EURO symbol. This is hardcoded as 'E' in Version 6. It can also be specified in the DEBUG option as in:
options debug='euro=xy';
where xy represents 2 hex characters. For example, on EBCDIC systems MVS and CMS:
options debug='euro=C1';
will cause the Euro symbol to be A, which has a hex representation of C1. On ASCII systems, this would be:
options debug='euro=41';
Consider the following example, run on an ASCII system:
options debug='euro=41';
data _null_;
input x @@;
put '*' x euro5. '*' x euro9.2 '*';
datalines;
1 1234.56 12345
;
produces
* A1* A1.00* *1,235*A1,234.56* *12345*12,345.00*
The conversion rates for the first eleven countries to agree to Euro conversion were established on 01JAN1999. These rates are immutable, and their values have been incorporated into the EURFRxxx and EURTOxxx formats and the EUROCURR function. However, the other countries whose currency rates are recognized by the function and formats will fluctuate, requiring the current rates to be specified externally. There are two places that can be examined to obtain the rates.
The first place examined is a text file referenced by the fileref EURFRTBL. The format of this text file is the name of the EURFRxxx format followed by = and followed by the conversion rate of the xxx currency to Euro. For example:
data _null_; file eurfrtbl;
input; put _infile_; datalines;
EURFRDKK=3.75
EURFRCHF=3
run;
In this case, there are 3.75 euros per Danish krone, and 3 euros per Swiss franc.
The EURFRDKK, EURFRCHF, EURTODKK, and EURTOCHF formats will try to read from the file referenced by EURFRTBL to find the conversion rates. There will be no error message if the file doesn't exist or if the rates cannot be found in the file. (There are preset rates built in to the formats and function; they can be seen in the CURRENCY CODES AND RATES section below).
The conversion rates can alternatively be specified in the DEBUG= option, as in:
options debug='EURFRDKK=3.75 EURFRCHF=3';
The EURFRTBL file is searched first, then the DEBUG= option is examined.
Note that if rates are specified for any of the "first eleven" countries within the DEBUG= option or EURFRTBL, those rates will be ignored, and the posted immutable rates will be used instead.
The arithmetic computations using the rates depend on which operation is requested. For the EURTOxxx formats, which convert from Euro to a local currency, the specified rate is multiplied by the number of Euros to derive the local currency amount. For the EURFRxxx formats, which convert from a local currency to Euro, the local currency amount is divided by this rate. The same process is followed for the EUROCURR function.
For example, consider our DEBUG= option of 'EURFRDKK=3.75 EURFRCHF=3'. The EURTODKK format will display 1 Euro as 3.75 and the EURTOCHF format will display 1 Euro as 3. The EURFRDKK format will display 3.75 as 1 (along with the Euro symbol) and the EURFRCHF format will display 3 as 1 with the Euro symbol. As for the EUROCURR function, consider the following:
data _null_;
z=eurocurr(1,'DKK','CHF');
x=eurocurr(1,'DKK','EUR');
y=eurocurr(x,'EUR','CHF');
put x= y= z=;
run;
This produces
x=0.2666666667 y=0.8 z=0.8
The first invocation of the EUROCURR function converts 1 DKK to CHF via triangulation. This involves converting DKK to Euro, and then converting Euro to CHF. The setting of X and Y shows the process of the triangulation. 1 DKK converts to 0.2666666667 Euro (computed by dividing 1 DKK by the rate of 3.75 specified in the DEBUG option), and that amount of Euro converts to 0.8 CHF (computed by dividing 0.2666666667 by 3, also specified in the DEBUG option).
Here are the 3-character currency codes and their meanings. These are used in the EUROCURR function, and are also used in naming the various formats in the package. Also listed are the rates that are hard-coded into the EURFRxxx formats, EURTOxxx formats, and the EUROCURR function.
| EUR | 1 | Euro |
| ATS | 13.7603 | Austrian schilling |
| BEF | 40.3399 | Belgian franc |
| FIM | 5.94573 | Finnish markka |
| FRF | 6.55957 | French franc |
| DEM | 1.95583 | Deutsche mark |
| IEP | 0.787564 | Irish pound |
| ITL | 1936.27 | Italian lira |
| LUF | 40.3399 | Luxembourg franc |
| NLG | 2.20371 | Dutch guilder |
| PTE | 200.482 | Portuguese escudo |
| ESP | 166.386 | Spanish peseta |
| CHF | 1.60430 | Swiss franc |
| DKK | 7.49009 | Danish krone |
| GBP | 0.700132 | British pound |
| GRD | 340.885 | Greek drachma |
| SEK | 9.36591 | Swedish krona |
| CZK | 34.8563 | Czech koruna |
| HUF | 260.325 | Hungarian forint |
| NOK | 9.19770 | Norwegian krone |
| RUR | 19.7680 | Russian ruble |
| TRL | 336.912 | Turkish lira |
| PLZ | 4.2 | Polish zloty |
| ROL | 13.71 | Romanian leu |
| YUD | 13.0644 | Yugoslavian dinar |
| SIT | 191 | Slovenian tolar |