The SASEXFSD Interface Engine (Experimental)

Getting Started: SASEXFSD Interface Engine

Table 43.1 shows the factlets that the SASEXFSD interface engine supports. A summary of each factlet’s optional parameters can be found in Table 43.5.

Table 43.1: Supported FactSet OnDemand Factlets

Supported Factlet

Example

ExtractFormulaHistory

Example 43.1, Example 43.2, Example 43.3

ExtractDataSnapshot

Example 43.4, Example 43.5

ExtractOFDBItem

Example 43.6

ExtractOFDBUniverse

Example 43.7

ExtractScreenUniverse

Example 43.8

ExtractEconData*

Example 43.9

* Supports only the FactSet Standardized Economic database.


The Prefix column in Table 43.2 contains the parameters that you are most likely to refer to when requesting data, but each factlet has its own set of optional parameters and default settings. Often the items that you select use a prefix (see the Prefix column) to designate the database where the item resides. Because the availability of data libraries and their contents are constantly changing, Table 43.2 is included for demonstration only. It lists some of the data libraries that FactSet offers.

Table 43.2: Sample Database Libraries Available through FactSet

Prefix

Database Description

ff

FactSet Fundamentals

fe

FactSet Estimates

fg

FactSet Global

p

FactSet Prices—Security Price Data


Table 43.2 shows only a subset of the available FactSet databases. For a comprehensive list that also includes third-party databases available through FactSet, see page ID 2014 in the FactSet Online Assistant.

To specify the data library, specify both a physical path to indicate the location of the data files (XML data returned from FactSet OnDemand) and the LIBNAME statement options to specify which factlet to use to request data items and the desired key IDs (such as ticker symbols or country codes) for your selection. The orientation of the data that are returned is ETI, entity time item, and is kept with sorted keys (entities or BY groups); each observation is indexed by time interval, and each time series data item is organized in columns by item name (time series variable name). The SASEXFSD engine supports the parameters required for each supported factlet.

You can use the SASEXFSD engine to access all available data library items. A subset of these data items, from the FactSet Fundamentals database, is shown in Table 43.3.

SAS 9.3 supports only the data items that return numeric values, not the data items that return characters. The output is not reliable if character data items are used.

For a complete list of data items for every category, see page ID 16331 in the FactSet Online Assistant (OA). A FactSet workstation user name and serial number are necessary to launch the FactSet Online Assistant from the FactSet workstation. A FactSet representative can provide these credentials.

Because the availability of data libraries and their contents are constantly changing, Table 43.3 is included for demonstration only. At the time of this writing, the available data list and items for the FactSet Fundamentals database sets looked like the list in Table 43.3.

Table 43.3: FactSet Fundamentals Database Sets

Formulas by Category

Data Items (SAS Variable Names) in Category

Identifiers

FF_CUSIP, FF_DISCL_ID, FF_ISIN, FF_SEDOL, FF_TICKER, FF_WS_ID

Balance sheet

FF_ASSETS, FF_BDEBT, FF_GW, FF_INVEN_FG, FF_PPE_DEP, FF_PPE_GROSS, FF_PAY_ACCT

Income statement

FF_COGS, FF_DEP_EXP, FF_DIL_ADJ, FF_EBIT, FF_EQ_AFF_INC, FF_EXP_OPER, FF_GROSS_INC

Cash flow

FF_DEBT_CF, FF_DIV_CF, FF_FIN_CF, FF_CAPEX, FF_INVEST_CF, FF_INVEST_PURCH_CF, FF_SALE_ASSETS_BUS_CF

Ratios

FF_ASSETS_EQ, FF_DEBT_EQ, FF_LIFE_INS, FF_LOAN_ASSETS, FF_NET_CAP_REQUIRE, FF_RD_SALES

Market data

FF_ACQ_DATE, FF_DIV_RATE, FF_ENTITY_TYPE, FF_PRICE_CLOSE, FF_PRICE_HIGH_52WK

Corporate data and classifications

FF_GEN_IND, FF_IND_GRP, FF_MAJOR_SUBIND, FF_SIC_CODE, FF_EMP_NUM

Financial records

FF_ACTG_STANDARD, FF_COVERAGE, FF_CURN_DOC, FF_DEPS_BK, FF_FREQ_CODE, FF_US_GAAP_AVAIL


To view a comprehensive list of FactSet Fundamentals data items, see page ID 15099 in the FactSet Online Assistant. If the page is not found, enter “FactSet Fundamentals” in the search box near the top of the page.

To specify which parts of the database to access, you supply two things: the appropriate keys (with the IDS= option) to select the companies or securities that you want to access, and the list of data items (with the ITEMS= option) that you want to retrieve. SAS 9.3 supports only the data items that return numeric values, not the data items that return characters. The output is not reliable if character data items are used.

To access company data, use the ExtractFormulaHistory factlet. Select the IDs that identify the companies that you want to access by specifying the entity ID (such as ticker symbol) for each company. Use the IDS= option to specify which ticker symbols to include.

For example, the following statements access the FactSet Fundamentals database for monthly sales data and the FactSet Price database for pricing data for IBM (ID=ibm) and FactSet Research Systems (ID=fds):

LIBNAME myLib sasexfsd "%sysget(FACTSET)"
   FACTLET=ExtractFormulaHistory
   FORMAT=sml
   OUTXML=gstart1
   AUTOMAP=replace
   MAPREF=MyMap
   XMLMAP="%sysget(FACTSET)gstart1.map"
   IDS='ibm,fds'
   ITEMS='p_price,ff_sales'
   DATES='20110130:20110631:m'
   ORIENTATION=eti
   user='XXXXXXXXXXXXXXXX'
   pass='XXXXXXXXXXXXXXXX';
   ;      
      
data company_pvol;
   set myLib.gstart1;                                                                                                                                                                                                                                  
run;

proc contents data=company_pvol; run;
proc print data=company_pvol; run;

Figure 43.1: Getting Started with ExtractFormulaHistory: Company_pvol

Obs FQL_ENTITY date p price p volume
1 ibm 06-15-2010 129.790 6652.61
2 ibm 07-15-2010 130.720 6187.52
3 ibm 08-15-2010 127.870 0.00
4 ibm 09-15-2010 129.430 4762.45
5 ibm 10-15-2010 141.060 7224.06
6 ibm 11-15-2010 143.640 3828.15
7 ibm 12-15-2010 144.720 4447.40
8 ibm 01-15-2011 150.000 0.00
9 ibm 02-15-2011 162.840 3768.70
10 ibm 03-15-2011 159.020 6485.55
11 fds 06-15-2010 71.270 621.75
12 fds 07-15-2010 71.090 195.70
13 fds 08-15-2010 75.090 0.00
14 fds 09-15-2010 82.370 349.58
15 fds 10-15-2010 86.730 397.66
16 fds 11-15-2010 87.960 119.73
17 fds 12-15-2010 91.300 413.60
18 fds 01-15-2011 95.050 0.00
19 fds 02-15-2011 105.390 134.54
20 fds 03-15-2011 98.260 643.53
21 goog 06-15-2010 497.990 4261.56
22 goog 07-15-2010 494.020 4858.78
23 goog 08-15-2010 486.350 0.00
24 goog 09-15-2010 480.640 2403.55
25 goog 10-15-2010 601.450 14824.72
26 goog 11-15-2010 595.470 3480.12
27 goog 12-15-2010 590.300 2168.13
28 goog 01-15-2011 624.180 0.00
29 goog 02-15-2011 624.150 2092.61
30 goog 03-15-2011 569.560 4006.38


The SASEXFSD interface engine supports only the SAS XML (SML) format and the ETI orientation. The XML data that are returned from the FactSet OnDemand service are placed in a file specified by the OUTXML= option. The XML map that is automatically created is assigned the full pathname specified by the XMLMAP= option, and the fileref that is used for the map assignment is specified by the MAPREF= option. In the following example, the SASEXFSD engine uses the MAPREF= and XMLMAP= options in the FILENAME statement to assign a filename:

   FILENAME MyMap "U:\factset\test\gstart1.map"; 

You can use the MAPREF= and XMLMAP= options to control where the map resides, what you name the map, and how you refer to it with a fileref. You can use the OUTXML= option to name your XML data file. It is placed in the folder designated by ‘physical-name’, and you can refer to it by using the myLib libref in your SASEXFSD LIBNAME statement. This is shown inside the DATA step in the SET statement, which names the input data set myLib.gstart1 and causes the reading of the gstart1.xml file to be input and stored in a SAS data set named Company_pvol.

The Company_pvol data set contains two time series variables (data items), p_price and ff_sales, as specified in the ITEMS= option, and the observation range is controlled by the DATES= option. The prefixes p_ and ff_ are the database designators for the Prices and FactSet Fundamentals databases, respectively, as shown in Table 43.2. The Company_pvol data set contains observations that range from January 30, 2011, to June 31, 2011, as specified in the DATES= option. The frequency of the data is monthly, as specified by the ‘m’ at the end of the DATES= option. See Figure 43.1 for the results.

To specify the list of data items that you want to retrieve, use the ITEMS= option. This option accepts a single-quoted string that denotes a list of data items that you are selecting for the resulting SAS data set. The data item names are separated by commas, so valid item names cannot contain embedded commas or quotes. The prefix in each data item name designates the data source as defined in the Prefix column of Table 43.2. SAS 9.3 supports only the data items that return numeric values, not the data items that return characters.

After the LIBNAME statement assigns the SASEXFSD libref, the database is opened. The selected data are organized into group entities (BY groups), which are sorted by date. In Figure 43.1, the tickers are the BY groups, and within each ticker, the observations are sorted by the time ID variable DATE.

You can also use the SAS DATA step to perform further subsetting and to store the resulting time series in a SAS data set.

The SASEXFSD engine for SAS 9.3m2 supports both 32-bit and 64-bit Windows.