The SASEXCCM Interface Engine

Example 40.3 Retrieving Data from Different Keysets

This example shows how to retrieve several data items from different keysets. You request data about research and development (R&D) expenses (XRD) and net income (NI) over all available keysets by using the itm_name.* syntax in the ITEMLIST= option. Note that data are not available for all items in all keysets. For brevity, a subset of the data that contains the most recent figures is specified by the WHERE statement.

title 'Retrieve R&D Expenses and Net Income for IBM';
libname _all_ clear;

libname crsp sasexccm "%sysget(CRSP_CCM)"
   setid=250
   gvkey=6066
   itemlist="xrd.*;ni.*";

data recent;
    set crsp.annitem;
    where datadate >= '1jan2001'd;

proc print data=recent;
run;

Output 40.3.1: R&D Expenses and Net Income for GVKEY=6066

Retrieve R&D Expenses and Net Income for IBM

Obs KYGVKEY KEYSET_TAG DATADATE XRD NI
1 6066 STD 20011231 4620.0000 7723.0000
2 6066 STD 20021231 4754.0000 3579.0000
3 6066 STD 20031231 5077.0000 7583.0000
4 6066 STD 20041231 5167.0000 8430.0000
5 6066 STD 20051230 5379.0000 7934.0000
6 6066 STD 20061229 5682.0000 9492.0000
7 6066 STD 20071231 5754.0000 10418.0000
8 6066 STD 20081231 6015.0000 12334.0000
9 6066 STD 20091231 5523.0000 13425.0000
10 6066 STD 20101231 5720.0000 14833.0000
11 6066 SUMM 20011231 . 6484.0000
12 6066 SUMM 20021231 . 2376.0000
13 6066 SUMM 20031231 . 6558.0000
14 6066 SUMM 20041231 . 7479.0000
15 6066 SUMM 20051230 . 7934.0000
16 6066 SUMM 20061229 . 9492.0000
17 6066 SUMM 20071231 . 10418.0000
18 6066 SUMM 20081231 . 12334.0000
19 6066 SUMM 20091231 . 13425.0000
20 6066 SUMM 20101231 . 14833.0000