(no subject)

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

(no subject)

Paul Egli
Hello list,
 
  I have an interesting data dilemma that I haven't found an easy work around as yet.
 
  Right now I have a list of 20 items, each respondent saw 5 of the 20.  The data I have has the data in the following format.
 
Resp1 0 0 0 0 5 0 0 0 0 10 0 0 13 0 0 16 0 0 0 20
.
.
.
Resp100 0 0 3 0 0 0 0 8 0 0 0 12 0 0 0 0 17 0 19 0
 
  What I would like to do is reformat the data so that resembles the following:
 
Resp1 5 10 13 16 20
.
.
.
Resp100 3 8 12 17 19
 
  Any help would be greatly appreciated.
 
Thanks,
 
Paul
_________________________________________________________________
Discover the new Windows Vista
http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE
Reply | Threaded
Open this post in threaded view
|

(no subject)

Maguin, Eugene
Paul,

I think I'd start with the following

Let v1 to v20 be the current variables and let y1 to y5 be the new list. I'm
going to assume that all non zero values are valid, no zero values are valid
and that every record has at most five non zero values.

The way to do this is with a Loop-End Loop structure.

Vector v=v1 to v20/y(5).
Compute #j=1.
Loop #i=1 to 20.
+  do if (v(#i) ne 0).
+     compute y(#j)=v(#i).
+     compute #j=#j+1.
+  end if.
End loop.
Execute.


Gene Maguin