Date: Tue, 27 Mar 2012 09:30:11 -0400
Reply-To: Dawn Wiest <DWiest@mail.acponline.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Dawn Wiest <DWiest@mail.acponline.org>
Subject: Re: replace missing values
In-Reply-To: <4F71BEE4.4060302@gmail.com>
Content-Type: multipart/alternative;
Thanks, Marta. Good to know!
Dawn
>>> Marta García-Granero<mgarciagranero@gmail.com> 3/27/2012 9:21 AM
>>>
Dawn:
Just using:
IF MISSING(Team1) Team1=LAG(Team1).
Works OK (I finally started SPSS and tested my code).
No need to DO REPEATs and DO IFs.
Best regards,
Marta GG
El 27/03/2012 15:15, Dawn Wiest escribió:
Frank,
This is the syntax I typically use to solve the problem you present
(I've added your variable team1 at the DO REPEAT line):
SET ERRORS=no.
DO IF $CASENUM >1.
DO REPEAT v= Team1.
IF LEN(RTRIM(v))=0 v=LAG(v).
IF MISSING(v) v=LAG(v).
END REPEAT PRINT.
END IF.
SET ERRORS=yes.
EXECUTE.
HTH
Dawn
>>> Marta García-Granero<mgarciagranero@gmail.com> (
mailto:mgarciagranero@gmail.com ) 3/27/2012 9:02 AM >>>
Hi:
Not tested (from memory):
If missing(team1) team1=lag(team1).
exe.
The EXE is not really necessary (*), unless you want to check
immediately that the result is OK.
Best regards,
Marta GG
(*) Here's to you, Richard (Ristow) ;)
El 27/03/2012 14:27, drfg2008 escribió:
> I have a missing data problem. The data is as following (variable
name=
> Team1):
>
> ****************
> Team1
> 1
> .
> .
> .
> 2
> .
> .
> 1
> .
> .
> .
> .
> 5
> .
> .
> .
>
> ************
>
> Now, I would like to fill the (system-) missings with the value on
top of
> them like that:
>
> ****************
> Team1
> 1
> 1
> 1
> 1
> 2
> 2
> 2
> 1
> 1
> 1
> 1
> 1
> 5
> 5
> 5
> 5
> ************
>
> The problem is that there is not always the same number of missings,
but
> sometimes 2 missings, sometimes 3, 4 or even more.
>
> I found a complicated and clumsy solution with a lot of IFs ... and
lags.
> Isn't there an elegant solution to the problem?
>
> Frank
>
> -----
> Dr. Frank Gaeth
> FU-Berlin
>
> --
> View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/replace-missing-values-tp5597687p5597687.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except
the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except
the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
[text/html]