Skip to content

Instantly share code, notes, and snippets.

Joost Impink JoostImpink

  • UF
  • Florida
Block or report user

Report or block JoostImpink

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am JoostImpink on github.
  • I am impink (https://keybase.io/impink) on keybase.
  • I have a public key whose fingerprint is 3B29 169E 938B 866A 7CBF 3085 3F4E 2E9E 02B9 C853

To claim this, I am signing this object:

@JoostImpink
JoostImpink / createDummyVars.sas
Created Jul 1, 2016
Macro to create dummy variables (non-missing values only)
View createDummyVars.sas
/* Helper macro to make dummy variables
Note: it is not robust for missing values
*/
%macro createDummyVars(dsin=, var=, newvar=);
proc sql noprint;
select distinct &var. into :mvals separated by '|'
from &dsin.;
/* Number of unique values */
%let mdim=&sqlobs;
quit;
@JoostImpink
JoostImpink / hayn_4_table_4b_assignment.sas
Created May 17, 2016
Hayn 1995 replicate table 4b assignment
View hayn_4_table_4b_assignment.sas
proc sort data=g_sample_wins; by gvkey;run;
proc reg data= g_sample_wins;
model ret = e_p ;
ods output ParameterEstimates = regout_1a FitStatistics = regout_1b;
/* adding by gvkey will result in separate regressions for each firm */
by gvkey;
quit;
@JoostImpink
JoostImpink / google_vs_industry_MTB.sas
Last active Mar 20, 2017
Google vs industry MTB benchmark
View google_vs_industry_MTB.sas
/* Example of how to use SAS to retrieve data from WRDS
Computing market-to-book ratio for years 2000-, and benchmark it against
other firms in the industry */
/* this piece of code makes a connection of your SAS instance with WRDS remote server */
%let wrds = wrds-cloud.wharton.upenn.edu 4016;options comamid = TCP remote=WRDS;
signon username=_prompt_;
/* any code executed on WRDS needs to go in a remote submit block, for example: */
@JoostImpink
JoostImpink / hayn_4_table_4.sas
Created May 13, 2016
Hayn 1995 replica, table 4
View hayn_4_table_4.sas
/* Regressions */
/* Some variables need to be created */
data g_sample;
set b_sample;
/* earnings per share scaled by beginning of year stock price */
e_p = epspx / prcc_f_lag;
/* change in eps scaled by boy stock price */
ch_e_p = (epspx - epspx_lag) / prcc_f_lag;
/* keep observations with no missings */
@JoostImpink
JoostImpink / hayn_3_table_3.sas
Created May 13, 2016
Hayn 1995 replica, table 3
View hayn_3_table_3.sas
/* For each size decile: compute #firm-years and #losses */
/* Create size deciles */
proc rank data = b_sample out = e_ranked groups = 10;
var size;
ranks size_d ;
run;
/* Add 1 to rank (0-9 => 1-10) */
data e_ranked;
@JoostImpink
JoostImpink / hayn_2_table_2.sas
Created May 13, 2016
Hayn 1995 replica, table 2
View hayn_2_table_2.sas
/* Table 2
Use firms that have at least 8 years of data
Count the number of loss-years
*/
/* For each gvkey, count the #loss-years */
proc sql;
create table d_table2_a as
select gvkey, sum(loss) as lossYears from b_sample
/* gvkey must be in the following table */
where gvkey IN (
@JoostImpink
JoostImpink / hayn_1_table_1.sas
Created May 13, 2016
Hayn 1995 replica, table 1
View hayn_1_table_1.sas
/* Table 1
Left panel shows by year the #obs, and the #loss years
Right panel shows the same, but for firms that were in the sample from 1968
through 1990 (23 years)
*/
/* Left panel */
/* Using SQL */
proc sql;
@JoostImpink
JoostImpink / hayn_0_construct_sample.sas
Last active Oct 5, 2017
Hayn 1995 replica, code to construct sample
View hayn_0_construct_sample.sas
/* We need to make a sample for US listed firms with fiscal years 1962-1990
From Compustat Funda we need:
- gvkey Firm identifier
- datadate End of fiscal year
- fyear Fiscal year
- epspx EPS before extraordinary items
- prcc_f Price at fiscal year end
- csho Common shares outstanding end of year (to compute market cap)
@JoostImpink
JoostImpink / intraday_return_SEC_filings.R
Last active Apr 24, 2016
Intraday return for SEC filings
View intraday_return_SEC_filings.R
## For each SEC filing stock return in the interval [time - before, time + after] is measured
# Set constants
before <- 0
after <- 7200
# load Grokit Nanex library
library(gtNanex)
# Load dataset with 8-K filings (symbol and timestamp)s
You can’t perform that action at this time.