This example shows how to use the ExtractBenchmarkDetail factlet to retrieve the holdings for the Standard & Poor’s (S&P) 500 (ID=’sp50’) and display the P_PRICE data that correspond to each holding. For brevity, only a subset of the output (the first 10 holdings) is displayed.
title 'Retrieve Benchmark Data for Top Ten Holdings, CUTOFF=10'; libname _all_ clear; libname fsd sasexfsd "%sysget(FACTSET)" factlet=ExtractBenchmarkDetail ids='sp50' items='p_price,proper_name' dates='20130320' cutoff=10 format=sml outXml=fsdex12 automap=replace mapref=MyMap xmlmap="%sysget(FACTSET)fsdex12.map" orientation=eti user='XXXXXXXXXXXXXXXX' pass='XXXXXXXXXXXXXXXX'; data bench; set fsd.fsdex12; run; proc print data=bench; run;
The CUTOFF= option limits the output to the number of holdings that are specified. This example uses CUTOFF=10 to print the top 10 holdings. If you omit the CUTOFF= option, all 500 holdings are reported.
Output 43.11.1: Retrieving Benchmark Data for Top 10 Holdings in the S&P 500 Index
Retrieve Benchmark Data for Top Ten Holdings, CUTOFF=10 |
Obs | FQL_ENTITY | date | SECURITY_ID | Weight | p_price | proper_name |
---|---|---|---|---|---|---|
1 | SP50 | 03-20-2013 | 03783310 | 3.05742 | 452.080 | Apple Inc. |
2 | SP50 | 03-20-2013 | 30231G10 | 2.85989 | 88.630 | Exxon Mobil Corp. |
3 | SP50 | 03-20-2013 | 36960410 | 1.75686 | 23.460 | General Electric Co. |
4 | SP50 | 03-20-2013 | 16676410 | 1.68383 | 120.350 | Chevron Corp. |
5 | SP50 | 03-20-2013 | 45920010 | 1.62263 | 215.060 | International Business Machines Corp. |
6 | SP50 | 03-20-2013 | 47816010 | 1.59946 | 79.450 | Johnson & Johnson |
7 | SP50 | 03-20-2013 | 38259P50 | 1.56568 | 814.708 | Google Inc. Cl A |
8 | SP50 | 03-20-2013 | 59491810 | 1.53648 | 28.315 | Microsoft Corp. |
9 | SP50 | 03-20-2013 | 74271810 | 1.52624 | 77.580 | Procter & Gamble Co. |
10 | SP50 | 03-20-2013 | 71708110 | 1.46471 | 28.290 | Pfizer Inc. |