libname HLM "C:\AAA PROJECTS\AAA1EstatU\SAS BOOK";
%let path=C:\temp\;
%let output=EG1.txt;
filename stud "&path&output";
data studd ;infile stud length=lg;input @;input @1 eachline $varying78. lg;
data coeff;set studd;
where eachline contains ", G";
run;
data coeff2;set coeff;
variablename=substr(eachline,1,14);
parametername=substr(eachline,17,5);
coef=substr(eachline,26,10);
SE=substr(eachline,39,10);
Tratio=substr(eachline,52,10);
DF=substr(eachline,63,5);
Pvalue=substr(eachline,71,5);
drop eachline;
if df ne "";
jun=500-_n_;
jun2=_n_;
run;
proc sort;by jun;run;
proc sort nodupkey;by parametername;
run;
proc sort;by jun2;run;
data varpicker;set studd;
*where eachline contains ", P"
and eachline contains ", B";
where eachline contains "INTRCPT3, G"
and eachline contains ", B"
;
eachline2=eachline;
*eachline=compress(eachline,"*#");
jun=indexc(eachline,",");
kore=substr(eachline,1,jun);
kore=left(compress(kore,","));
*jun=_n_-1;
*G="G";
*zero="0";
*length kore $ 4;
*parametername=compress(G||jun||zero||zero);
keep kore parametername;
are=index(eachline,", G")+2;
parametername=substr(eachline,are,10);
run;
proc sort;by parametername;
run;
data final;
retain
variablename parametername coef SIG SE Tratio DF Pvalue
;
merge coeff2 varpicker ;
by parametername;
if kore ne "" then do;
variablename=kore;
end;
variablename=left(variablename);
drop jun kore x;
x=index(variablename,"slope");
jun=_n_;
xxx=" by ";
if x =0 and jun ne 1 then variablename=xxx||variablename;
drop xx xxx jun2
;
pvalue=pvalue+0;
length SIG $ 5;
if pvalue < 0.1 then Sig='~';
if pvalue < 0.05 then Sig='*';
if pvalue < 0.01 then Sig='**';
if pvalue < 0.001 then Sig='***';
if pvalue < 0.0001 then Sig='****';
if pvalue <-9999 then Sig=' ';
run;
proc print;
title1 "HLM3: Final estimation of fixed effects (with robust standard errors)";
title2 "'#' - The residual parameter variance for the parameter has been set to zero";
title3 "'*' - This variable has been centered around its group mean";
title4 "'%' - This variable has been centered around its grand mean";
run;
data variance;set studd;
where eachline contains
"," and
(
eachline contains
" R0 "
or eachline contains " R1"
or eachline contains " R2"
or eachline contains " R3"
or eachline contains " R4"
or eachline contains " R5"
or eachline contains " R6"
or eachline contains " R7"
or eachline contains " R8"
or eachline contains " R9"
or eachline contains " R10"
or eachline contains " E"
or eachline contains "U00"
or eachline contains "U10 "
or eachline contains "U20 "
or eachline contains "U30 "
or eachline contains "U40 "
or eachline contains "U50 "
or eachline contains "U60 "
or eachline contains "U70 "
or eachline contains "U80 "
or eachline contains "U90 "
)
or eachline contains "Random Effect Standard Variance df Chi-square P-value"
or eachline contains "Deviation Component"
;
proc print;
title "HLM3 Deviance score";
run;
data deviance;set studd;
where eachline contains " Deviance"
or eachline contains "Number of estimated parameters"
or eachline contains "The maximum number of level"
or eachline contains "Output file name"
;
eachline=left(eachline);
run;
proc print;
title "HLM3 Deviance score";
run;
/*
%include "C:\HLM5\Examples\AppendxA\HSB1.sas" ;
run;
data residual;set sas.resfil;
run;
proc print;run;
*/