The example data for running the following models can be downloaded here.
* right censored;
proc nlmixed data = nls qpoints=15 EBOPT;
parms _cons = 1 _age= .01 s2 = .3 sigma = .3;
xb = _cons + _age*age + u ;
if ln_wage <1.8 then ll = -.5*log(2*constant('PI'))- log(sigma) -(ln_wage-xb)**2/(2*sigma**2);
if ln_wage >=1.8 then ll = log(1 - cdf('NORMAL', (1.8-xb)/sigma));
model ln_wage ~ general(ll);
random u ~ normal (0,s2) subject=id;
run;
* left censored;
proc nlmixed data = nls qpoints=15 EBOPT;
parms _cons = 1 _age= .01 s2 = .3 sigma = .3;
xb = _cons + _age*age + u ;
if ln_wage >.5 then ll = -.5*log(2*constant('PI'))- log(sigma) -(ln_wage-xb)**2/(2*sigma**2);
if ln_wage <=.5 then ll = log(cdf('NORMAL', (.5-xb)/sigma));
model ln_wage ~ general(ll);
random u ~ normal (0,s2) subject=id;
run;
* right and left-censored;
proc nlmixed data = nls qpoints=15 EBOPT;
parms _cons = 1 _age= .01 s2 = .3 sigma = .3;
xb = _cons + _age*age + u ;
if ln_wage >.5 & ln_wage < 1.8 then ll = -.5*log(2*constant('PI'))- log(sigma) -(ln_wage-xb)**2/(2*sigma**2);
if ln_wage <=.5 then ll = log(cdf('NORMAL', (.5-xb)/sigma));
if ln_wage >=1.8 then ll = log(1 - cdf('NORMAL', (1.8-xb)/sigma));
model ln_wage ~ general(ll);
random u ~ normal (0,s2) subject=id;
run;
