stk_partial
This program creates a new CRSPAccess CRSPDB stock database from an existing database or appends securities from one database to another. It can use a permlist or a data type restriction to subset the original database. It takes parameters on input and output databases, input and output set types, data wanted in the new database, and optionally a file containing PERMNOs to copy to the new database.
Usage
stk_partial inpath outpath insetid outsetid setwanted datawanted [permfile]
Parameter Values
- inpath
- Input CRSPDB directory path. The directory where the database is stored. Standard environment names can be used such as $CRSP_DSTK or $CRSP_MSTK on UNIX, %crsp_dstk% or %crsp_mstk% on Windows.
- outpath
- Output CRSPDB directory path. The directory where the new database will be stored. This can be an empty directory or an existing directory. If it is an empty directory, a new database will be created. If there is already a CRSPDB in that directory, the selected PERMNOs will be added to that database.
- insetid
- Input Setid. The input database set type. Use one of:
- 10
- if a daily stock database
- 20
- if a monthly stock database
- outsetid
- Output Setid. The output database set type. Input and output index setids should be the same.
- setwanted
- Set wanted. A binary flag to determine the modules that will be supported in the new database. Use 32767 to support all current modules. A module that is not loaded at this time cannot be added later to that database.
- datawanted
- Data wanted. A binary flag to determine which modules will be copied
to the new database. Use 32767 to copy all data to the new database.
Data wanted must be a subset of set wanted. Individual wanted codes
can be summed to load multiple modules. Individual modules codes are:
- 1
- headers
- 2
- events (names, distributions, shares, delists, NASDAQ info)
- 4
- lows
- 8
- highs
- 16
- prices
- 32
- total returns
- 64
- volumes
- 128
- portfolios
- 256
- NASDAQ bids
- 512
- NASDAQ asks
- 1024
- Returns without dividends
- 2048
- spread
- 4096
- NASDAQ number of trades or alternate price dates
- 8192
- alternate prices or open prices
- 16384
- groups
- permfile
- (optional) The name of a file with a list of PERMNOs, one to a line. This parameter is optional. If it is used, only the PERMNOs in the input file will have data copied to the new database. If the parameter is not used, all PERMNOs in the input database will be copied.
Examples
Windows
If a file with PERMNOs of interest is available in the file, perm.inp, stk_partial can be run at the command prompt to create a subset monthly database in the folder c:\masub\ with the command:
stk_partial %crsp_mstk% c:\masub\ 20 20 32767 32767 perms.inp
If you change the CRSP_MSTK environment variable to point to C:\masub\, ts_print and mstkprint can be used to access this new database.