WRDS Macros: cvccmlnk.sas

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 tabe.                                            *
 *************************************************************************/
 
  libname mylocal 'C:\CRSP\Data';
 
/*------------------  use this part if using SAS/Connect-----------------
  %let wrds = wrds.wharton.upenn.edu 4016;
  options comamid=TCP remote=WRDS;
  signon username=_prompt_;
 
  rsubmit;
 ---------------------------------------------------------------------- */
 
  libname ccm '/wrds/crsp/sasdata/cc';
  
  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;
 
/* the following part only needed when using SAS Connect
     
  proc download data=CCMXPF_LINKTABLE out=mylocal.linktable;
  run;
 
  endrsubmit;
  signoff;
 
  proc print data=mylocal.CCMXPF_LINKTABLE (obs=10);
  run;
 
*/
 
/* ********************************************************************************* */
/* *************  Material Copyright Wharton Research Data Services  *************** */
/* ****************************** All Rights Reserved ****************************** */
/* ********************************************************************************* */

Top of Section

Top