(View the complete code for this example.)
This simple example shows how to use the ExtractFormulaHistory factlet to retrieve price data for one company (in this case IBM).
options validvarname=any;
title 'Retrieve Price Data for IBM';
libname _all_ clear;
libname xfsd sasexfsd "%sysget(FACTSET)"
debug=on
factlet=ExtractFormulaHistory
ids='ibm'
items='p_price'
dates='20110130:20111231:m'
format=sml
outXml=fsdex01
automap=replace
mapref=MyMap
xmlmap="%sysget(FACTSET)fsdex01.map"
orientation=eti
user='XXXXXXXXXXXXXXXX'
pass='XXXXXXXXXXXXXXXX';
data recentprice; set xfsd.fsdex01; run;
proc print data=recentprice; run;
Output 56.6.1: Price Data for IBM
| Retrieve Price Data for IBM |
| Obs | FQL_Entity | date | p_price |
|---|---|---|---|
| 1 | ibm | 01-31-2011 | 162.00 |
| 2 | ibm | 02-28-2011 | 161.88 |
| 3 | ibm | 03-31-2011 | 163.07 |
| 4 | ibm | 04-30-2011 | 170.58 |
| 5 | ibm | 05-31-2011 | 168.93 |
| 6 | ibm | 06-30-2011 | 171.55 |
| 7 | ibm | 07-31-2011 | 181.85 |
| 8 | ibm | 08-31-2011 | 171.91 |
| 9 | ibm | 09-30-2011 | 174.87 |
| 10 | ibm | 10-31-2011 | 184.63 |
| 11 | ibm | 11-30-2011 | 188.00 |
| 12 | ibm | 12-31-2011 | 183.88 |