DM Stat-1 Articles
Link to Home

Link to Articles

Link to Consulting

Link to Seminar

Link to Stat-Chat

Link to Software

Link to Clients

Technical Report #7:
Creating Time-on-File Variable
Bruce Ratner, Ph.D.

Objective: To create a Time-on-File (months) variable, an important variable for acquisition and retention modeling, as well as for segmentation.


Solution:

data dates_on_file;
input name $ date_on_file :mmddyy10.;
cards;
Abe     12/31/1973
Bruce   02/28/1976
Charles 03/29/1976
Dain     03/01/1976
Everett 12/12/1976
Frank   02/14/1971
George  11/09/1967
Hanks   07/02/1955
Irwin     07/30/1960
Jake      06/23/1959
;
run;

data months_on_file;
set dates_on_file;
date_data_pulled='15apr2002'd;
format date_on_file date_data_pulled worddate20.;
months_on_File =int(intck('month',date_on_file,date_data_pulled));
if month(date_on_file) = month(date_data_pulled) 
     then months_on_File =months_on_File -(day(date_on_file)>day(date_data_pulled));
run;

proc print;
run;



For more information about this article, call Bruce Ratner at 516.791.3544,
1 800 DM STAT-1, or e-mail at br@dmstat1.com.