cvccmlnk.sas - Macro

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.

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