Replace missing value

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Replace missing value

Yawen LI-2
Dear lister,

Can anybody tell me how to write syntax to solve this problem?

I want to replace the missing value of year 2004 with the value from year
2006 X 90%.


Thanks

Yawen

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Replace missing value

Clive Downs
On Tue, 23 Dec 2008 02:14:38 -0800, Yawen LI <[hidden email]> wrote:

>Dear lister,
>
>Can anybody tell me how to write syntax to solve this problem?
>
>I want to replace the missing value of year 2004 with the value from year
>2006 X 90%.
>
>
>Thanks
>
>Yawen
>

>
Hi,

I think the following will do this, if I understand your question correctly.


* set up data
*--------------------------------------------------------------------.

DATA LIST FREE/  id(A3)  yr2004 yr2006.
BEGIN DATA

001  250 275
002 275 320
003  .  100
004 . 200
END DATA.

* work out missing 2004 data - if 2004 is missing substitute 90 % of 2006 .
*------------------------------.

IF SYSMIS(yr2004) yr2004 = (yr2006 * .90).
EXE.

results in  :

001        250.00   275.00
002        275.00   320.00
003         90.00   100.00
004        180.00   200.00

Clive.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
Reply | Threaded
Open this post in threaded view
|

Re: Replace missing value

Albert-Jan Roskam
In reply to this post by Yawen LI-2
Hi,

Something like this?
if ( year = 2004 and missing(var2004) ) var2004 = var2006 * 0.90.

Cheers & Merry Xmas!!
Albert-Jan


--- On Tue, 12/23/08, Yawen LI <[hidden email]> wrote:

> From: Yawen LI <[hidden email]>
> Subject: Replace missing value
> To: [hidden email]
> Date: Tuesday, December 23, 2008, 11:14 AM
> Dear lister,
>
> Can anybody tell me how to write syntax to solve this
> problem?
>
> I want to replace the missing value of year 2004 with the
> value from year
> 2006 X 90%.
>
>
> Thanks
>
> Yawen
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (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
[hidden email] (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