cvccmlnk.sas - Macro

This macro creates the CCMXPF_LINKTABLE data set. It contains data from the Link History table as well as the USEDFLAG variable from the Link Used table.

Deprecated Code

For a period of time, WRDS created a linking table by combining the Compustat-centric lnkhist table with the CRSP-centric lnkused table. WRDS discontinued this practice in 2014 in favor of using the lnkhist table for most purposes. Researchers are cautioned to fully understand the underlying tables and the results of combining them before proceeding.

Top of Section

Example

/*************************************************************************
 * Program        :    cvccmlnk.sas                                      *
 * Author         :    WRDS/M Duan                                       *
 * Version        :    1.0                                               *
 * Date Created   :    April, 2009                                       *
 * Last Modified  :    -                                                 *
 *                                                                       *  
 *  Usage :                                                              *
 *   This macro creates the CCMXPF_LINKDTABLE data set. It contains      *
 *   data from the Link History table as well as the USEDFLAG variable   *
 *   from the Link Used table.                                            *
  
  libname ccm '/wrds/crsp/sasdata/a_ccm';
  
  data CCMXPF_LINKTABLE (label="CRSP/COMPUSTAT Merged - Link History w/ Used Flag");
    merge ccm.ccmxpf_lnkused (in=u keep=ugvkey uiid upermno upermco ulinkdt ulinkenddt usedflag rename=(ugvkey=gvkey uiid=liid upermno=lpermno upermco=lpermco ulinkdt=linkdt ulinkenddt=linkenddt))
          ccm.ccmxpf_lnkhist (in=h);
    by gvkey liid lpermno lpermco linkdt linkenddt;
    if h=1 and u=0 and missing (usedflag) then usedflag=0;
  run;
 
  proc sort data=CCMXPF_LINKTABLE noduprec;
   by gvkey lpermno lpermco linkdt linkenddt;
  run;
 
  proc print;
  run;
 
 
/* ********************************************************************************* */
/* *************  Material Copyright Wharton Research Data Services  *************** */
/* ****************************** All Rights Reserved ****************************** */
/* ********************************************************************************* */

Top of Section

Top