wide-to-long

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

wide-to-long

nina
Dear all,

I'd like to convert my data which are currently in a 'wide' format to the 'long' format - this seems to be an easy task,  but the tricky issue (at least for me) is that each case has only been observed once, but I need a long format that adds 365 days (= rows) for each case...which syntax should one use?

Best,
Nina
Reply | Threaded
Open this post in threaded view
|

Re: wide-to-long

Maguin, Eugene
You know, some more information about the data structure would be oh so helpful. For instance, Is the current data structure like this: id x1 x2 v1 to v365?  And you want to go to this:
Id x1 x2 1 v
Id x1 x2 2 v
Id x1 x2 3 v
Just saying, this is the most simple and it's in the syntax reference.

Or is it like this: id x1 x2?  And you want to go to this:
Id x1 x2 1
Id x1 x2 2
Id x1 x2 3

Or ???

Gene Maguin


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of nina
Sent: Monday, August 14, 2017 9:50 AM
To: [hidden email]
Subject: wide-to-long

Dear all,

I'd like to convert my data which are currently in a 'wide' format to the 'long' format - this seems to be an easy task,  but the tricky issue (at least for me) is that each case has only been observed once, but I need a long format that adds 365 days (= rows) for each case...which syntax should one use?

Best,
Nina



--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/wide-to-long-tp5734648.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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: wide-to-long

Mike
Eugene,

Another interpretation is that the data is

ID day x1

and the OP wants

ID day1 x1
ID day2 x1
ID day3 x1
....
ID day4 x1

Each case would have 365 "rows" but with 364 blank rows because
a case is only observed/measured one -- I assume a variable
like "day" (either 1 to 365 or a specific date in a one year
time frame) has to be present or created.

I have to admit that I don't understand why someone would
something like this, so it's probably wrong (at least I hope so).

-Mike Palij
New York University
[hidden email]


----- Original Message -----
From: "Maguin, Eugene" <[hidden email]>
To: <[hidden email]>
Sent: Monday, August 14, 2017 9:57 AM
Subject: Re: wide-to-long


You know, some more information about the data structure would be oh so
helpful. For instance, Is the current data structure like this: id x1 x2
v1 to v365?  And you want to go to this:
Id x1 x2 1 v
Id x1 x2 2 v
Id x1 x2 3 v
Just saying, this is the most simple and it's in the syntax reference.

Or is it like this: id x1 x2?  And you want to go to this:
Id x1 x2 1
Id x1 x2 2
Id x1 x2 3

Or ???

Gene Maguin


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
nina
Sent: Monday, August 14, 2017 9:50 AM
To: [hidden email]
Subject: wide-to-long

Dear all,

I'd like to convert my data which are currently in a 'wide' format to
the 'long' format - this seems to be an easy task,  but the tricky issue
(at least for me) is that each case has only been observed once, but I
need a long format that adds 365 days (= rows) for each case...which
syntax should one use?

Best,
Nina



--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/wide-to-long-tp5734648.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
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

=====================
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: wide-to-long

David Marso
Administrator
In reply to this post by nina
nina wrote
Dear all,

I'd like to convert my data which are currently in a 'wide' format to the 'long' format - this seems to be an easy task,  but the tricky issue (at least for me) is that each case has only been observed once, but I need a long format that adds 365 days (= rows) for each case...which syntax should one use?

Best,
Nina
Nina,
You really have not provided sufficient information for us to make any reasonable suggestions.
 I do suspect LOOP and XSAVE will come into play. Search these archives for examples.
HTH
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"