delete values / create sysmis

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

delete values / create sysmis

Postby GerineL » Fri Apr 18, 2014 10:31 am

Spss 20, windows 7/8.


How can I remove values form an spss file?



In reality my file is much bigger, but as an example:

I have 11 vars (Id, and v1 to v10), and 10 cases (case 1 to case 10).
I want to remove the value in v1 for case 1, the value in v2 for case 2 etc, so I have a value in every cell except when the row/column matches.

I can create a new variable (v11 to v20) that is dependent on ID number (something like:

If (ID = 8) v11 = v1.
If (ID = 8) v12 = v2.
If (ID = 8) v13 = v3.
... and then skip: If (ID = 8) v18 = v8.

but I would much rather do something like:

if (ID = 8) v8 = sysmis.


BUt this doesn't work.
Any ideas?
apeape
Posts: 56
Joined: Mon May 02, 2011 6:07 pm

Re: delete values / create sysmis

Postby apeape » Sat Apr 19, 2014 3:55 am

Try

Code: Select all

vector x = v1 to v10.
loop #i = 1 to 10.
if id = #i x(#i) = $sysmis.
end loop.
exe.
GerineL
Moderator
Posts: 1477
Joined: Tue Jun 10, 2008 4:50 pm

Re: delete values / create sysmis

Postby GerineL » Tue Apr 22, 2014 9:04 am

works like a charm, thanks!

Who is online

Users browsing this forum: No registered users and 2 guests

cron