View Full Version : SPSS syntax for missing data
06-29-2008, 01:30 PM
If I wanted to substitute the means for missing data for questionnaires I am using, but only if participants completed no less than 70% of the items, what would the syntax be. Any help would be most welcome! Thanks!
08-30-2008, 03:10 PM
Same here! I am struggling to find out. Let you know if it was sorted out.
Hmmm. Something like that?
* QUESTION: How to replace missing values of scale1 TO scale17 by the mean
* value but only when number of missing is less than 75% of scales.
* ANSWER posted to SPSSX-L on 2001/5/15 by firstname.lastname@example.org.
* Define dummy data file for illustration purposes.
LOOP id=1 TO 50.
LOOP #id=1 TO 17.
* about 25% of scales will be missing.
IF (UNIFORM(1)<.75) scale(#id)=TRUNC(UNIFORM(5)+.5).
END INPUT PROGRAM.
* Start the job.
/mscale1 to mscale17=mean(scale1 to scale17).
MATCH FILES FILE=* /TABLE='c:\temp\mydata.sav' /by dummy.
DO IF (NMISS(scale1 to scale17) < 17*.25).
+ DO REPEAT orig = scale1 to scale17 /copy=mscale1 to mscale17.
+ if (missing (orig)) orig=copy.
+ END REPEAT.
> Free Syntax files (http://pages.infinit.net/rlevesqu/SampleSyntax.htm) (a lots!)
Powered by vBulletin™ Version 4.1.3 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.