Transform cases in variables

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

Transform cases in variables

Carlos Renato (www.estatistico.org)
Dear friends of the list

I have a problem that consists in transform each n-cases in
v-variables from a variable that contains all information.
For example, supose de follow dataset:

Var1
(age person 1)
(sex person 1)
(eye color person 1)
(age person 2)
(sex person 2)
(eye color person 2)
(age person 3)
(sex person 3)
(sex person 1)
.
.
.
Then, I want to transform this dataset in a new dataset with the
format below:

Age                       sex                        eye
(age person 1)        (sex person 1)        (eye color person 1)
(age person 2)        (sex person 2)        (eye color person 2)
(age person 3)        (sex person 3)        (eye color person 3)

Thanks for all.

Carlos Renato
Statistician






Reply | Threaded
Open this post in threaded view
|

extracting time stamp from a date-time stamp

J P-6
Hello,
 
I am sure there is a simple answer to this, but I am spending way too much time trying to figure it out.
 
I have a variable formatted as a date-time value (dd-mmm-yyyy hh:mm:ss). I need the time as a separate variable. How can this be done?
 
Thanks in advance,
John






Reply | Threaded
Open this post in threaded view
|

Re: extracting time stamp from a date-time stamp

Lemon, John S.

Use the date and time wizard in the transform menu

 

Best Wishes

 

John S. Lemon

DIT ( Directorate of Information Technology ) - Student Liaison Officer

University of Aberdeen

Edward Wright Building: Room G51

 

Tel:  +44 1224 273350

Fax: +44 1224 273372

 

Diary ( Free / Busy )

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of J P
Sent: 19 May 2009 15:19
To: [hidden email]
Subject: extracting time stamp from a date-time stamp

 

Hello,

 

I am sure there is a simple answer to this, but I am spending way too much time trying to figure it out.

 

I have a variable formatted as a date-time value (dd-mmm-yyyy hh:mm:ss). I need the time as a separate variable. How can this be done?

 

Thanks in advance,

John




 



The University of Aberdeen is a charity registered in Scotland, No SC013683.
Reply | Threaded
Open this post in threaded view
|

Re: extracting time stamp from a date-time stamp

Richard Ristow
In reply to this post by J P-6
At 10:18 AM 5/19/2009, J P wrote:

I am sure there is a simple answer to this, I have a variable formatted as a date-time value (dd-mmm-yyyy hh:mm:ss). I need the time as a separate variable.

At 10:25 AM 5/19/2009, Lemon, John S. wrote:

Use the date and time wizard in the transform menu

Right. But it's good to know the good old syntax, too, especially here it's very direct (but untested):

COMPUTE TimePart = XDATE.TIME(DateTime).
FORMATS TimePart (TIME10).

Going farther, this is an area where the Command Syntax Reference, section
Universals > Date and Time,
is good, and pretty readable. It includes formats, functions for building date-time variables, functions for taking differences and extracting parts. The CSR is probably a file named spssbase.pdf on your SPSS install disk.
===================== 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