01-19-2012 12:14 PM
I have a dataset with lots of variables (20+) and not many observations (countries by each geographic locations).
There are many missing values for each observation.
I want to do two things:
1. Using proc reg: Run OLS with only variables that have common non-missing values.
For example, if I have a dataset looks like below:
var1 var2 var3 var4 var5
1 . 3 . 4
2 . . 3 5
How can I set up commands such that it runs regression with only var1 and var5 (that have values in common). My understanding is that proc reg drops all observations that have missing values.
2. Using proc calis: FIML
I read an article :Making Use of Incomplete Observations in the Analysis of Structural Equation Models: The CALIS Procedure’s Full Information Maximum Likelihood Method in
SAS/STAT 9.3 byYiu-Fai Yung and Wei Zhang, SAS Institute Inc., Cary NC
I have SAS 9.2 and it seems this FIML in proc CALIS procedure is not available for 9.2. I get an error message like below:
proc calis data=WB_FAO2_sub1 method=FIML;
ERROR 22-322: Syntax error, expecting one of the following: ADF, D, DWLS, G, GLS, LS, LSADF, LSD,
LSDWLS, LSG, LSGLS, LSM, LSMAX, LSML, LSW, LSWLS, M, MAX, ML, NONE, U, ULS, W, WLS.
ERROR 76-322: Syntax error, statement will be ignored.
How can I run FIML in SAS 9.2?
Please help me out on this. Thanks a lot!
01-30-2012 11:30 AM
I can help with question 1, but not question 2.
Finding which variables are always nonmissing is easy. Here's one approach.
proc means data=mydata nmiss maxdec=0;
This doesn't automate the process at all, but it's not clear from your post whether you need to do that and whether your familiarity with macro language would be sufficient for that task. In theory, it would be possible for PROC MEANS to create an output data set, and for subsequent processing to capture the names of the variables that have NMISS = 0. That "subsequent processing" could create a macro variable holding the list of variable names and pass that list to PROC REG. Is that the path that you need to travel, or is the simple version good enough?
01-30-2012 12:00 PM
You can use the code below to get rid of all the variables with missing value.
1 . 3 . 4
2 . . 3 5
options missing= ' ';
proc transpose data=one out=two;
length keep $500;
if 0 then set one nobs=nvar;
do until (done);
set two end=done;
if n(of col eq nvar then keep=catx(' ',keep,_name_);
set one (keep=&keep);
proc print data=want;run;
Obs var1 var5
1 1 4
2 2 5