Keyset Usage for Stock

The porttype and grouptype values for Portfolios (using /dy) and Groups (using /gp) can be accessed as either porttype and grouptype values or as keyset offsets. See here for a list of CRSP Portfolio Types.

  • ‚Daily porttype values 1-9 equate to keyset values 101-109.
  • Monthly porttype values 1-8 equate to keyset values 201-208.
  • grouptype values 1-50 equate to keyset values 301-350. Note that S&P 500 Constituents is currently the only valid group, represented by grouptype 16 or keyset 316.

The advantage to using keyset offsets is that they provide unique values across all frequencies of databases. stk_print maintains an offset for each group, so the user can specify the porttype or grouptype or the actual keyset. Both the porttype values and keyset offsets will access the same data. stk_print will appropriately translate porttype into keyset offsets if they are unknown.

Keysets are supplied as a period followed by * for all, or a list for specific selections. If no keyset is supplied, an item’s default keyset is assumed.

For example, the following three notations all get portfolio type 1:

/dy
/dy.1
/dy.101

The following notation gets all portfolios:

/dy.*

In the CRSP subscriber Stock and Index Databases, only portfolios have multiple keysets.

The command:

/ml port.1,6;stat.1,6 returns portfolio assignments and statistics for keysets 1 and 6.

For example:

Portfolio History
-------
KEYSET = 1 (NYSE/NYSE MKT LLC/NASDAQ Cap Assignments)
Year Port Stat
2005 10 129836292.57970
2006 10 146342099.09851
2007 10 148956933.39741
 
KEYSET = 6 (NYSE/NYSE MKT Betas)
Year Port Stat
2005 6 0.78004
2006 7 0.72267
2007 7 0.77042

Available Keysets

Daily

PORTTYPE KEYSET NAME
1 101 NYSE/NYSE MKT/NASDAQ Cap Assignments
2 102 Nyse/NYSE MKT Cap Assignments
3 103 NASDAQ Cap Assignments
4 104 NYSE Cap Assignments
5 105 NYSE MKT Cap Assingments
6 106 NYSE/NYSE MKT Betas
7 107 NYSE/NYSE MKT Standard Deviations
8 108 NASDAQ Betas
9 109 NASDAQ Standard Deviations

Monthly

PORTTYPE KEYSET NAME
1 101 NYSE/NYSE MKT/NASDAQ Cap Assignments
2 102 Nyse/NYSE MKT Cap Assignments
3 103 NASDAQ Cap Assignments
4 104 NYSE Cap Assignments
5 105 NYSE MKT Cap Assingments
6 106 Cap-Based NYSE/NYSE MKT.NASDAQ National Market
7 107 Cap-Based NYSE
8 108 Cap-Based NYSE/NYSE MKT