(View the complete code for this example.)
This example shows how to use the ExtractFormulaHistory factlet to retrieve several data items for several companies. The data items are price and sales, and the companies are IBM and FactSet (FDS).
options validvarname=any;
title 'Retrieve Price and Sales Data for IBM and FactSet(FDS)';
libname _all_ clear;
libname xfsd sasexfsd "%sysget(FACTSET)"
debug=on
factlet=ExtractFormulaHistory
ids='ibm,fds'
items='p_price,ff_sales'
dates='20110130:20110631:m'
format=sml
outXml=fsdex02
automap=replace
mapref=MyMap
xmlmap="%sysget(FACTSET)fsdex02.map"
orientation=eti
user='XXXXXXXXXXXXXXXX'
pass='XXXXXXXXXXXXXXXX';
data priceSale; set xfsd.fsdex02; run;
proc print data=priceSale; run;
Output 56.7.1: Multiple Data Items for IBM and FactSet
| Retrieve Price and Sales Data for IBM and FactSet(FDS) |
| Obs | FQL_ENTITY | date | p_price | ff_sales |
|---|---|---|---|---|
| 1 | ibm | 01-31-2011 | 162.000 | 99870.00 |
| 2 | ibm | 02-28-2011 | 161.880 | 99870.00 |
| 3 | ibm | 03-31-2011 | 163.070 | 99870.00 |
| 4 | ibm | 04-30-2011 | 170.580 | 99870.00 |
| 5 | ibm | 05-31-2011 | 168.930 | 99870.00 |
| 6 | ibm | 06-30-2011 | 171.550 | 99870.00 |
| 7 | fds | 01-31-2011 | 100.800 | 641.06 |
| 8 | fds | 02-28-2011 | 104.880 | 641.06 |
| 9 | fds | 03-31-2011 | 104.730 | 641.06 |
| 10 | fds | 04-30-2011 | 109.410 | 641.06 |
| 11 | fds | 05-31-2011 | 110.860 | 641.06 |
| 12 | fds | 06-30-2011 | 102.320 | 641.06 |