transform rows and columns

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

transform rows and columns

David Burns-5
Hi everyone, I would be grateful for any help. I am trying to flip a data
base, so the rows become the columns, and vice versa, in spss. However,
when I follow the basic syntax, it only seems to work for numeric data. I
have numbers, but also some words or dates. Is there a way to flip the
rows and columns?

I can be more specific if needed.

David Burns, MD
Adjunct (volunteer) Clinical Professor, Stanford University School of
Medicine

=====================
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: transform rows and columns

John McConnell-2
Hi David

Could you AutoRecode your String variables(words) first?

Menu:
Transform|Automatic Recode

This converts strings to numerics and is really intended for situations
where the string vars are effectively nominal categories e.g. Region
rather than situations where the strings are [relatively] unique. It
could still provide a workaround if the latter is true.

John

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
David Burns
Sent: 25 July 2009 02:01
To: [hidden email]
Subject: transform rows and columns

Hi everyone, I would be grateful for any help. I am trying to flip a
data
base, so the rows become the columns, and vice versa, in spss. However,
when I follow the basic syntax, it only seems to work for numeric data.
I
have numbers, but also some words or dates. Is there a way to flip the
rows and columns?

I can be more specific if needed.

David Burns, MD
Adjunct (volunteer) Clinical Professor, Stanford University School of
Medicine

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: transform rows and columns

Richard Ristow
In reply to this post by David Burns-5
At 09:00 PM 7/24/2009, David Burns wrote:

>I am trying to flip a data base, so the rows become the columns, and
>vice versa, in spss. However, when I follow the basic syntax, it
>only seems to work for numeric data. I have numbers, but also some
>words or dates. Is there a way to flip the rows and columns?

What you say you want, is categorically impossible.

All values of an SPSS variable ('column') have the same datatype.  If
your data includes variables with different datatypes (as is very
common), then the datatypes are not all the same within cases
('rows'); and so, the 'rows' cannot become 'columns'.

What are you trying to do, by flipping? SPSS has many tools, and it's
very likely there's another way to get to what you want to do.

-Best of luck,
  Richard

=====================
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: transform rows and columns

Richard Ristow
At 11:46 AM 7/27/2009, David Burns wrote, off-list:

I will probably have to change the cells with words to numbers in order to do this. Can you declare all your columns (variables) as strings, which may allow them to contain words and non-numerical values such as dates, and flip them?

It would make sense to do that, if all the strings had the same length, but FLIP doesn't seem to support it:

  • String variables in the original file are assigned system-missing [numeric] values after transposition.
(SPSS 14 Command Syntax Reference, p. 644)

Otherwise I may have to replace everything with numbers to flip the rows and columns without losing data.

It sounds like that's it. But, if you like, post what you're trying to do, for which FLIP might be a solution.
===================== 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