Unfortunately that some of my earlier posted pages are missing from the WordPress site and I am not sure how it happened.
reference: https://www.youtube.com/watch?v=JQHAA_AGxrE
reference: https://www.youtube.com/watch?v=V2wBBB0wNRc
It is very common when conducting survey, the results are incomplete or having missing values. Most of the statistics procedures will drop the observation with missing values which will some time render the survey unable to draw conclusion due to not enough sample size. SAS provides some procedures to impute those missing values so the observation can be used for analysis.
/* --- Identify Missing Value --- */
proc format;
value $missfmt ' ' = 'Missing' other = 'Not Missing';
value missfmt . = 'Missing' other = 'Not Missing';
run;
proc freq ;
format _char_ $missfmt.;
format _numeric_ missfmt.;
tables _char_ / missing nocum nopercent;
tables _numeric_ /missing nocum nopercent;
run;
/* --- Multiple Impuatation Method --- */
/* --- Step 1. Generate Imputed Samples --- */
proc mi data = data nimpute=20 seed = 135782
out = ImputedSample;
var v1-v3;
run;
quit;
/* --- Step 2. Fit the Generated Imputed Samples --- */
proc reg data= ImputedSample outest=Estimates covout;
model v1 = v2-v3;
by _Imputation_;
run;
quit;
/* --- Step 3: Use Proc Mianalyze --- */
proc mianalyze data = Estimates;
modeleffects Intercept v2 v3;
run;
quit;
/* --- Direct maximum Likelyhood --- */
/* --- Step 1. Proc Calis --- */
proc calis data = d2 method = fiml;
path v1 <--- v2 v3;
run;
quit;
Numeric missing value in the SAS table some time shows as . (dot)and other times as _ (underscore). When the value of the variable are used to create categorical variable, please taking the null value into consideration. Sometimes the condition ‘ne .’ would not exclude null values but ‘gt .’ can. The following macro is used to identify the significance of the p value. There are some null value in the p-value variable
%macro sig (data =,stat=, var =);
%let i=1;
%do %while (%scan(&data., &i, ' ') ne );
%let dsn=%scan(&data., &i, ' ');
%put &dsn.;
data &dsn._&stat.;
set &dsn._&stat. ;
format sig&var. $4. prob&var. pvalue6.4;
if Prob&var.=0.01 then sig&var.="*";
if Prob&var.=0.001 then sig&var.="**";
if Prob&var.=0.0001 then sig&var.="***";
if Prob&var.<0.0001 and Prob&var. gt . then sig&var.="****"; /* exclude null value */
if Prob&var.<0.0001 and Prob&var. ne . then sig&var.="****"; /* ne . doesn't work. **** shows for null p-value/
run;
%let i = %eval (&i +1);
%end;
%mend sig;
%sig (data =group1 group2, stat= anova, var= f);