Credits:
 
Code is based in part on Giuseppe Cardillo' s excellent logrank code for MatLab
http://www.mathworks.com/matlabcentral/fileexchange/22317 - logrank

Details:

Function uses some Mathematica 8 functionalitiy, expecially, SurvivalDistribution[data]

Input format:

See example below, 
group1 = {{Time_1, CensorIndicator_1},...};
group2 = {{Time_1, CensorIndicator_1},...};

KMtableGen[xi_]:=
(
x1=Sort[xi];

times=x1[[All,1]];

UniqueAndCounts={#,Flatten[Position[times,#]]}&/@Union[times];

timesU=UniqueAndCounts[[All,1]];
failed=Table[0,{x,1,Length[timesU]}];
atrisk=Table[0,{x,1,Length[timesU]}];
censored=Table[0,{x,1,Length[timesU]}];
atriskbegin=Length[times];
atrisk[[1]]=atriskbegin;
failed[[1]]=Length[UniqueAndCounts[[1,2]]];

For[i=2,i≤Length[timesU],i++,
failed[[i]]=Length[UniqueAndCounts[[i,2]]];
atrisk[[i]]=atrisk[[i-1]]-failed[[i-1]];
];

For[i=1,i≤Length[timesU],i++,
entries=Flatten[UniqueAndCounts[[i,2]]];
If[Length[entries]==1,cens=x1[[entries[[1]],2]];];
If[Length[entries]==2,cens=Total[x1[[entries[[1]];;entries[[2]],2]]];];
If[Length[entries]>2,cens=Total[x1[[entries[[1]];;entries[[-1]],2]]];];
censored[[i]]=cens;
];

failed=failed-censored;

KMtable=Transpose[{timesU,failed,atrisk,censored}];

Return[KMtable];
)

LogRank[x1_,x2_]:=
(

table1=KMtableGen[x1];
table2=KMtableGen[x2];

A = Union[table1[[All,1]],table2[[All,1]]];

table12=Table[0,{i,Length[A]},{j,11}];
table12[[All,1]]=A;

For[i=1,i≤Length[table12],i++,
entry=table12[[i,1]];
entrytoaddpos=Flatten[Position[table1[[All,1]],x_/;x==entry]];
If[Length[entrytoaddpos]>0,
table12[[i,2]]=table1[[entrytoaddpos[[1]],2]];
table12[[i,3]]=table1[[entrytoaddpos[[1]],3]];
table12[[i,4]]=table1[[entrytoaddpos[[1]],4]];
];
];

For[i=1,i≤Length[table12],i++,
entry=table12[[i,1]];
entrytoaddpos=Flatten[Position[table2[[All,1]],x_/;x==entry]];
If[Length[entrytoaddpos]>0,
table12[[i,5]]=table2[[entrytoaddpos[[1]],2]];
table12[[i,6]]=table2[[entrytoaddpos[[1]],3]];
table12[[i,7]]=table2[[entrytoaddpos[[1]],4]];
];
];

(* Remove the rows where both treatments have zero deaths *)
t10=Flatten[Position[table12[[All,2]],x_/;x==0]];
t20=Flatten[Position[table12[[All,5]],x_/;x==0]];

needToDrop=Intersection[t10,t20];

For[i=Length[needToDrop],i≥1,i--,table12=Drop[table12,{needToDrop[[i]]}];];

(* Fill in blanks - we need the "at risk" numbers, so use the uncensored SurvivalDistribution[data] *)
data1=x1[[All,1]];
data2=x2[[All,1]];

𝒟1=SurvivalDistribution[data1];
𝒟2=SurvivalDistribution[data2];

zeropos=Flatten[Position[table12[[All,3]],x_/;x==0]];
For[i=1,i≤Length[zeropos],i++,table12[[zeropos[[i]],3]]=Round[SurvivalFunction[𝒟1,table12[[zeropos[[i]],1]]]*Length[x1o]];];zeropos=Flatten[Position[table12[[All,6]],x_/;x==0]];
For[i=1,i≤Length[zeropos],i++,table12[[zeropos[[i]],6]]=Round[SurvivalFunction[𝒟2,table12[[zeropos[[i]],1]]]*Length[x2o]];];

tableJ=Drop[table12,{},{4,4}];
tableJ=Drop[tableJ,{},{6,6}];

(* Total failures and remaining 'at risk' before the i-th time interval *)
tableJ[[All,6]]=tableJ[[All,2]]+tableJ[[All,4]];
tableJ[[All,7]]=tableJ[[All,3]]+tableJ[[All,5]];

(* using wikipedia nomenclature, per http://en.wikipedia.org/wiki/Logrank_test *)
O1j=tableJ[[All,2]];
Oj=tableJ[[All,6]];
N1j=tableJ[[All,3]];
Nj=tableJ[[All,7]];
E1j=Oj*(N1j/Nj);

tableJ[[All,8]]=O1j-E1j;

(* LR statistic is the sum of column 8 values *)
UL=N[Abs[Total[tableJ[[All,8]]]]];

(* Variance *)
ONE=Table[1,{x,1,Length[table12]}];
Vj=E1j*(ONE-(N1j/Nj));
Vj=Vj*(Nj-Oj);
Vj=Vj/(Nj-ONE);

SUL = N[Sqrt[Total[Vj]]] ;(*Compute the total standard error*)
Z = Abs[UL/SUL];(* normalized UL *)
p=2.0*(1.0-0.5*Erfc[-Zp/Sqrt[2]]);(*p-value*)

(*Chi-Squared*)
t=tableJ[[All,1]];
n=tableJ[[All,7]];
n1=tableJ[[All,3]];
n2=tableJ[[All,5]];
r=tableJ[[All,6]];

o1=tableJ[[All,2]];
o2=tableJ[[All,4]];

e1=r*(n1/n);
e2=r*(n2/n);

ChiSq=((Total[o1]-Total[e1])^2/Total[e1])+((Total[o2]-Total[e2])^2/Total[e2]);

Print["ChiSq  : ",  NumberForm[N[ChiSq],{6,6}]];
Print["LR statistic: ", NumberForm[N[UL],{6,6}]];
Print["S.E.: ", NumberForm[N[SUL],{6,6}]];
Print["Z: ", NumberForm[Z,{6,5}]];
Print["p-value: ", NumberForm[p,{6,6}]];

);

group1={{1,0},{1,0},{2,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{8,0},{8,0},{10,0},{12,0},{12,0},{14,0},{17,0},{20,1},{27,0},{27,0},{28,0},{30,0},{30,0},{36,0},{38,1},{40,1},{45,1},{50,0},{50,0},{50,0},{63,1},{132,1},{132,1},{1,0}};

group2={{1,0},{2,0},{3,0},{4,0},{6,0},{7,0},{12,0},{15,1},{20,1},{21,1},{24,0},{30,1},{60,1},{85,1},{85,1},{86,1},{87,1},{90,1},{100,1},{119,1},{132,1}};

eventTimes1 = group1[[All,1]];
eventTimes2 =  group2[[All,1]];

censorIndicators1 =  group1[[All,2]]; 
censorIndicators2 = group2[[All,2]];

𝒟1=SurvivalDistribution[Censoring[eventTimes1,censorIndicators1]];
𝒟2=SurvivalDistribution[Censoring[eventTimes2,censorIndicators2]];

p1=Table[{x,SurvivalFunction[𝒟1,x]},{x,0,Max[group1]-1}];
p2=Table[{x,SurvivalFunction[𝒟2,x]},{x,0,Max[group2]-1}];

p1=ListPlot[p1,PlotStyle->Red,PlotRange->All,AxesOrigin->{0,0},Joined->True];
p2=ListPlot[p2,PlotRange->All,AxesOrigin->{0,0},Joined->True];

Show[p1,p2,PlotRange->All]

Print["***************************************************"];
Print["Mean1: ",Mean[𝒟1]," SD: ",Sqrt[Variance[𝒟1]]];
Print["Mean2: ",Mean[𝒟2]," SD: ",Sqrt[Variance[𝒟2]]];
Print["***************************************************"];
LogRank[group1,group2]
Print["***************************************************"];