Skip to content

Instantly share code, notes, and snippets.

View JoostImpink's full-sized avatar

Joost Impink JoostImpink

View GitHub Profile
@JoostImpink
JoostImpink / earnings_management_models.sas
Last active March 30, 2024 04:49
Estimate earnings management models
/*
Earnings management models
Author: Joost Impink, March 2016
Models estimated:
- Jones model, tac = a0 + a1 1/TAt-1 + a2chSales + a3PPE + a4ROA + error.
- variable names DA_Jones ABSDA_Jones
- Modified Jones model, as Jones model, but using chSales - chREC to compute fitted values.
@JoostImpink
JoostImpink / array.sas
Created February 1, 2016 02:19
Clay's Array, Do_over and Numlist macros
%MACRO ARRAY(arraypos, array=, data=, var=, values=,
delim=%STR( ), debug=N, numlist=Y);
/* last modified 8/4/2006 a.k.a. MACARRAY( ).
72nd col -->|
Function: Define one or more Macro Arrays
This macro creates one or more macro arrays, and stores in them
character values from a SAS dataset or view, or an explicit list
of values.
@JoostImpink
JoostImpink / winsorize.sas
Last active January 24, 2019 01:33
winsorize macro
/*****************************************
Author unknown - that is a pity because this macro is the best since sliced bread!
Trim or winsorize macro
* byvar = none for no byvar;
* type = delete/winsor (delete will trim, winsor will winsorize;
*dsetin = dataset to winsorize/trim;
*dsetout = dataset to output with winsorized/trimmed values;
*byvar = subsetting variables to winsorize/trim on;
@JoostImpink
JoostImpink / CCI.sas
Last active September 7, 2023 23:35
WRDS - create dataset with Compustat, CRSP and IBES identifiers
/*
Macro that creates a dataset with Compustat, CRSP and IBES identifiers (gvkey, permno, Ibes ticker)
for fiscal years in period start-end.
macro parameters:
@dsout: name of dataset to create
@start: start year
@end: end year
@compvars: list of variables to get from compustat, default value: at sale ceq ni
@minscore: ibes iclink minimum score (0 [default] is best score, 6 worst, see iclink.sas)