SIGNOFF SPSSX-L

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

SIGNOFF SPSSX-L

Shanta Griffin


--- On Mon, 5/4/09, Automatic digest processor <[hidden email]> wrote:
From: Automatic digest processor <[hidden email]>
Subject: SPSSX-L Digest - 2 May 2009 to 3 May 2009 (#2009-124)
To: "Recipients of SPSSX-L digests" <[hidden email]>
Date: Monday, May 4, 2009, 12:07 AM

There are 12 messages totalling 701 lines in this issue.

Topics of the day:

  1. Custom Format Time Variable (10)
  2. Remove values in several hundred consecutive varaibles (2)

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

----------------------------------------------------------------------

Date:    Sun, 3 May 2009 14:21:33 -0400
From:    Brock <[hidden email]>
Subject: Custom Format Time Variable

Hi Everyone,

I have a dataset with a variable that is a time, expressed as minutes and
seconds.  Think of a sporting event.  In SPSS, I see all sorts of time
formats, but none seem to allow me to format my variable as mm:ss.  Can I
create a custom format my variable?

Many thanks,

Brock

------------------------------

Date:    Sun, 3 May 2009 12:47:01 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable

How about the TIME format?

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Brock
Sent: Sunday, May 03, 2009 12:22 PM
To: [hidden email]
Subject: Custom Format Time Variable

Hi Everyone,

I have a dataset with a variable that is a time, expressed as minutes and
seconds.  Think of a sporting event.  In SPSS, I see all sorts of time
formats, but none seem to allow me to format my variable as mm:ss.  Can I
create a custom format my variable?

Many thanks,

Brock

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

------------------------------

Date:    Sun, 3 May 2009 15:08:57 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable

Thanks for your help.

1) I am reading a text file that has a time variable.

2) I read the field in as a string since SPSS wants to make the
minutes->hours and seconds->minutes.

3)I then 'extract' the minutes into a seperate, numeric field called
'mins'
and the seconds into a numeric field called 'secs'.

4) I run date/time wizard to get the following syntax (it includes the 0 for
me):
       COMPUTE  time=TIME.HMS(0, mins, secs).

5) I get the error telling me that I am using an invalid combination of data
types, yet I can't complete the date/time wizard without converting the
mins
and secs variables to numeric.

Thanks,

brock


------------

OK, you have to provide more information like what your data look like,
where you are reading them from, and what you intend to do with the
resulting variable. And do that publicly so others can chime in.

-----Original Message-----
From: Tibert, Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 12:58 PM
To: 'ViAnn Beadle'
Subject: RE: Custom Format Time Variable

Thanks for taking the time to respond.  Maybe I am missing something, but
even on page 63 of the command syntax reference (V17), I do not see how I
can modify/create syntax to make my variable mm:ss. I am not a professional
syntax writer, but typically can work my way through it.

I tried using the Date/Time wizard but keep getting an error.  The syntax
that is returned is:

COMPUTE  time=TIME.HMS(0, mins, secs).

But I am getting an error telling me that there is an invalid combination of
data types, yet mins and seconds (my two variables) are numeric.

Thanks,

Brock

------------------------------

Date:    Sun, 3 May 2009 13:27:50 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable

How do you extract the components of the string variable? What syntax is
used? All of the arguments to TIME.HMS must be numeric. Here's an example
which uses the substr function to pluck out the minutes and seconds and the
use TIME.HMS.

data list list /x (a9).
begin data
04:02.22
05:33.01
end data.
compute mins=number(substr(x,1,2),f2).
compute secs=number(substr(x,4),f5).
compute time=TIME.HMS(0,mins,secs).
format time (time12.2).
list time.

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Brock
Sent: Sunday, May 03, 2009 1:09 PM
To: [hidden email]
Subject: Re: Custom Format Time Variable

Thanks for your help.

1) I am reading a text file that has a time variable.

2) I read the field in as a string since SPSS wants to make the
minutes->hours and seconds->minutes.

3)I then 'extract' the minutes into a seperate, numeric field called
'mins'
and the seconds into a numeric field called 'secs'.

4) I run date/time wizard to get the following syntax (it includes the 0 for
me):
       COMPUTE  time=TIME.HMS(0, mins, secs).

5) I get the error telling me that I am using an invalid combination of data
types, yet I can't complete the date/time wizard without converting the
mins
and secs variables to numeric.

Thanks,

brock


------------

OK, you have to provide more information like what your data look like,
where you are reading them from, and what you intend to do with the
resulting variable. And do that publicly so others can chime in.

-----Original Message-----
From: Tibert, Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 12:58 PM
To: 'ViAnn Beadle'
Subject: RE: Custom Format Time Variable

Thanks for taking the time to respond.  Maybe I am missing something, but
even on page 63 of the command syntax reference (V17), I do not see how I
can modify/create syntax to make my variable mm:ss. I am not a professional
syntax writer, but typically can work my way through it.

I tried using the Date/Time wizard but keep getting an error.  The syntax
that is returned is:

COMPUTE  time=TIME.HMS(0, mins, secs).

But I am getting an error telling me that there is an invalid combination of
data types, yet mins and seconds (my two variables) are numeric.

Thanks,

Brock

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

------------------------------

Date:    Sun, 3 May 2009 15:40:59 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable

This is the syntax I have been running to extract the mins/seconds and try
to create a new variable.  You can see that when the data are read into
SPSS, a time may be:

18:46, or
3:20, or
0:17

and is originally stored as a string.


STRING  mins (A2).
COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
EXECUTE.


STRING  secs (A2).
COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time) -
CHAR.INDEX(Time,':')).
EXECUTE.


ALTER TYPE  mins(F2.0).
ALTER TYPE  secs(F2.0).
FORMATS  mins(F2.0).
FORMATS  secs(F2.0).
EXECUTE.

COMPUTE  time=TIME.HMS(0, mins, secs).
VARIABLE LABELS  time "".
VARIABLE LEVEL  time (SCALE).
FORMATS  time (TIME8).
VARIABLE WIDTH  time(8).
EXECUTE.

------------------------------

Date:    Sun, 3 May 2009 13:57:30 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable

You are trying to replace values in variable time which is a string with
numeric values in

COMPUTE time=TIME.HMS...

Although SPSS retains case when storing variable names, comparisons are case
insensitive so Time == time.

Change your output variable to some new variable name.

-----Original Message-----
From: Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 1:41 PM
To: [hidden email]; ViAnn Beadle
Subject: Re: Custom Format Time Variable

This is the syntax I have been running to extract the mins/seconds and try
to create a new variable.  You can see that when the data are read into
SPSS, a time may be:

18:46, or
3:20, or
0:17

and is originally stored as a string.


STRING  mins (A2).
COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
EXECUTE.


STRING  secs (A2).
COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time) -
CHAR.INDEX(Time,':')).
EXECUTE.


ALTER TYPE  mins(F2.0).
ALTER TYPE  secs(F2.0).
FORMATS  mins(F2.0).
FORMATS  secs(F2.0).
EXECUTE.

COMPUTE  time=TIME.HMS(0, mins, secs).
VARIABLE LABELS  time "".
VARIABLE LEVEL  time (SCALE).
FORMATS  time (TIME8).
VARIABLE WIDTH  time(8).
EXECUTE.

------------------------------

Date:    Sun, 3 May 2009 16:26:45 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable

I am sorry, as this is probably much easier than I am making it out to be,
but I am lost.  I am passing three numeric values in the time.hms function,
and that is where I am getting the error stating that I am using an invalid
combination of variables.

I looked up the function just to make sure I understood the function
correctly, and it says that it requires numeric values.

My apologies, but I guess I do not understand what I am doing incorrectly,
especially since the syntax was generated from the GUI.

------------------------------

Date:    Sun, 3 May 2009 16:31:51 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable

I apologize for the frustration, but I just changed the variable name as you
said.  I was getting hung up on the error message.

Thanks,

Brock

------------------------------

Date:    Sun, 3 May 2009 18:18:41 -0400
From:    Art Kendall <[hidden email]>
Subject: Re: Custom Format Time Variable

Open a new instance of SPSS.  Copy the syntax below to a syntax file.
Click <run>. Click <all>.
Is this what you are looking for?

data list list/ ms_string (a5).
begin data
18:46
3:20
0:17
end data.
string hms_string (a7).
compute hms_string = concat('0:',ms_string).
compute timelapse= number(hms_string,time7.0).
format timelapse(time7).
list.

Art Kendall
Social Research Consultants



Brock wrote:
> This is the syntax I have been running to extract the mins/seconds and try
> to create a new variable.  You can see that when the data are read into
> SPSS, a time may be:
>
> 18:46, or
> 3:20, or
> 0:17
>
> and is originally stored as a string.
>
>
> STRING  mins (A2).
> COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
> EXECUTE.
>
>
> STRING  secs (A2).
> COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time)
-
> CHAR.INDEX(Time,':')).
> EXECUTE.
>
>
> ALTER TYPE  mins(F2.0).
> ALTER TYPE  secs(F2.0).
> FORMATS  mins(F2.0).
> FORMATS  secs(F2.0).
> EXECUTE.
>
> COMPUTE  time=TIME.HMS(0, mins, secs).
> VARIABLE LABELS  time "".
> VARIABLE LEVEL  time (SCALE).
> FORMATS  time (TIME8).
> VARIABLE WIDTH  time(8).
> EXECUTE.
>
> =====================
> 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
>
>

------------------------------

Date:    Sun, 3 May 2009 18:37:23 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable

Thanks for your help!  For me, all I did was change the variable name from
"time" to something else.

- Brock

------------------------------

Date:    Sun, 3 May 2009 16:24:47 -0500
From:    Jim Arnold <[hidden email]>
Subject: Remove values in several hundred consecutive varaibles

--001485f99c7eda0bdb046908ac61
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello List,
I am attempting to delete the values in a consecutive series of variables
(several thousand of them) using the following syntax:

do if comp ne 1.
do repeat clear = Q1 to D7.
compute clear = $sysmis.
end repeat.
end if.
exe.

I am rather new with SPSS syntax so I'm guessing there's something very
fundamental at work here that's causing the problem.  The above code runs
but it does not do as I need.  Values are not cleared from the variables
from Q1 to D7.  What am I missing here?

--001485f99c7eda0bdb046908ac61
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hello List,<div><br></div><div>I am attempting to
delete the values in a co=
nsecutive series of variables (several thousand of them) using the followin=
g syntax:</div><div><br></div><div>do if comp ne
1.</div><div>do repeat cle=
ar =3D Q1 to D7.</div>
<div>compute clear =3D $sysmis.</div><div>end
repeat.</div><div>end if.</di=
v><div>exe.</div><div><br></div><div>I
am rather new with SPSS syntax so I&=
#39;m guessing there&#39;s something very fundamental at work here
that&#39=
;s causing the problem. =A0The above code runs but it does not do as I need=
. =A0Values are not cleared from the variables from Q1 to D7. =A0What am I =
missing here?</div>

--001485f99c7eda0bdb046908ac61--

------------------------------

Date:    Sun, 3 May 2009 18:47:37 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Remove values in several hundred consecutive varaibles

This is a multipart message in MIME format.

------=_NextPart_000_0005_01C9CC1F.A2755220
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit

What is your goal?



From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim
Arnold
Sent: Sunday, May 03, 2009 3:25 PM
To: [hidden email]
Subject: Remove values in several hundred consecutive varaibles



Hello List,



I am attempting to delete the values in a consecutive series of variables
(several thousand of them) using the following syntax:



do if comp ne 1.

do repeat clear = Q1 to D7.

compute clear = $sysmis.

end repeat.

end if.

exe.



I am rather new with SPSS syntax so I'm guessing there's something very
fundamental at work here that's causing the problem.  The above code runs
but it does not do as I need.  Values are not cleared from the variables
from Q1 to D7.  What am I missing here?


------=_NextPart_000_0005_01C9CC1F.A2755220
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered
medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>What is your
goal?<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0in 0in 0in'>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
SPSSX(r) =
Discussion
[mailto:[hidden email]] <b>On Behalf Of </b>Jim
Arnold<br>
<b>Sent:</b> Sunday, May 03, 2009 3:25 PM<br>
<b>To:</b> [hidden email]<br>
<b>Subject:</b> Remove values in several hundred consecutive =
varaibles<o:p></o:p></span></p>

</div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Hello List,<o:p></o:p></p>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>I am attempting to delete the values in a =
consecutive series
of variables (several thousand of them) using the following =
syntax:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>do if comp ne 1.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>do repeat clear =3D Q1 to
D7.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>compute clear =3D
$sysmis.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>end repeat.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>end if.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>exe.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>I am rather new with SPSS syntax so I'm guessing
=
there's
something very fundamental at work here that's causing the problem. =
&nbsp;The
above code runs but it does not do as I need. &nbsp;Values are not =
cleared from
the variables from Q1 to D7. &nbsp;What am I missing =
here?<o:p></o:p></p>

</div>

</div>

</body>

</html>

------=_NextPart_000_0005_01C9CC1F.A2755220--

------------------------------

End of SPSSX-L Digest - 2 May 2009 to 3 May 2009 (#2009-124)
************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: SIGNOFF SPSSX-L

Hector Maletta
Shanta, this is not the way, Look at the message below, stating: To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
Command SIGNOFF SPSSX-L.
You sent the message to SPSSX-L and omitted the command in the body of the message. Two errors in one message.
 
Hector

.

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Shanta Griffin
Sent: 05 May 2009 01:18
To: [hidden email]
Subject: SIGNOFF SPSSX-L

 



--- On Mon, 5/4/09, Automatic digest processor <[hidden email]> wrote:

From: Automatic digest processor <[hidden email]>
Subject: SPSSX-L Digest - 2 May 2009 to 3 May 2009 (#2009-124)
To: "Recipients of SPSSX-L digests" <[hidden email]>
Date: Monday, May 4, 2009, 12:07 AM

There are 12 messages totalling 701 lines in this issue.
 
Topics of the day:
 
  1. Custom Format Time Variable (10)
  2. Remove values in several hundred consecutive varaibles (2)
 
=====================
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
 
----------------------------------------------------------------------
 
Date:    Sun, 3 May 2009 14:21:33 -0400
From:    Brock <[hidden email]>
Subject: Custom Format Time Variable
 
Hi Everyone,
 
I have a dataset with a variable that is a time, expressed as minutes and
seconds.  Think of a sporting event.  In SPSS, I see all sorts of time
formats, but none seem to allow me to format my variable as mm:ss.  Can I
create a custom format my variable?
 
Many thanks,
 
Brock
 
------------------------------
 
Date:    Sun, 3 May 2009 12:47:01 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable
 
How about the TIME format?
 
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Brock
Sent: Sunday, May 03, 2009 12:22 PM
To: [hidden email]
Subject: Custom Format Time Variable
 
Hi Everyone,
 
I have a dataset with a variable that is a time, expressed as minutes and
seconds.  Think of a sporting event.  In SPSS, I see all sorts of time
formats, but none seem to allow me to format my variable as mm:ss.  Can I
create a custom format my variable?
 
Many thanks,
 
Brock
 
=====================
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
 
------------------------------
 
Date:    Sun, 3 May 2009 15:08:57 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable
 
Thanks for your help.
 
1) I am reading a text file that has a time variable.
 
2) I read the field in as a string since SPSS wants to make the
minutes->hours and seconds->minutes.
 
3)I then 'extract' the minutes into a seperate, numeric field called
'mins'
and the seconds into a numeric field called 'secs'.
 
4) I run date/time wizard to get the following syntax (it includes the 0 for
me):
       COMPUTE  time=TIME.HMS(0, mins, secs).
 
5) I get the error telling me that I am using an invalid combination of data
types, yet I can't complete the date/time wizard without converting the
mins
and secs variables to numeric.
 
Thanks,
 
brock
 
 
------------
 
OK, you have to provide more information like what your data look like,
where you are reading them from, and what you intend to do with the
resulting variable. And do that publicly so others can chime in.
 
-----Original Message-----
From: Tibert, Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 12:58 PM
To: 'ViAnn Beadle'
Subject: RE: Custom Format Time Variable
 
Thanks for taking the time to respond.  Maybe I am missing something, but
even on page 63 of the command syntax reference (V17), I do not see how I
can modify/create syntax to make my variable mm:ss. I am not a professional
syntax writer, but typically can work my way through it.
 
I tried using the Date/Time wizard but keep getting an error.  The syntax
that is returned is:
 
COMPUTE  time=TIME.HMS(0, mins, secs).
 
But I am getting an error telling me that there is an invalid combination of
data types, yet mins and seconds (my two variables) are numeric.
 
Thanks,
 
Brock
 
------------------------------
 
Date:    Sun, 3 May 2009 13:27:50 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable
 
How do you extract the components of the string variable? What syntax is
used? All of the arguments to TIME.HMS must be numeric. Here's an example
which uses the substr function to pluck out the minutes and seconds and the
use TIME.HMS.
 
data list list /x (a9).
begin data
04:02.22
05:33.01
end data.
compute mins=number(substr(x,1,2),f2).
compute secs=number(substr(x,4),f5).
compute time=TIME.HMS(0,mins,secs).
format time (time12.2).
list time.
 
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Brock
Sent: Sunday, May 03, 2009 1:09 PM
To: [hidden email]
Subject: Re: Custom Format Time Variable
 
Thanks for your help.
 
1) I am reading a text file that has a time variable.
 
2) I read the field in as a string since SPSS wants to make the
minutes->hours and seconds->minutes.
 
3)I then 'extract' the minutes into a seperate, numeric field called
'mins'
and the seconds into a numeric field called 'secs'.
 
4) I run date/time wizard to get the following syntax (it includes the 0 for
me):
       COMPUTE  time=TIME.HMS(0, mins, secs).
 
5) I get the error telling me that I am using an invalid combination of data
types, yet I can't complete the date/time wizard without converting the
mins
and secs variables to numeric.
 
Thanks,
 
brock
 
 
------------
 
OK, you have to provide more information like what your data look like,
where you are reading them from, and what you intend to do with the
resulting variable. And do that publicly so others can chime in.
 
-----Original Message-----
From: Tibert, Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 12:58 PM
To: 'ViAnn Beadle'
Subject: RE: Custom Format Time Variable
 
Thanks for taking the time to respond.  Maybe I am missing something, but
even on page 63 of the command syntax reference (V17), I do not see how I
can modify/create syntax to make my variable mm:ss. I am not a professional
syntax writer, but typically can work my way through it.
 
I tried using the Date/Time wizard but keep getting an error.  The syntax
that is returned is:
 
COMPUTE  time=TIME.HMS(0, mins, secs).
 
But I am getting an error telling me that there is an invalid combination of
data types, yet mins and seconds (my two variables) are numeric.
 
Thanks,
 
Brock
 
=====================
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
 
------------------------------
 
Date:    Sun, 3 May 2009 15:40:59 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable
 
This is the syntax I have been running to extract the mins/seconds and try
to create a new variable.  You can see that when the data are read into
SPSS, a time may be:
 
18:46, or
3:20, or
0:17
 
and is originally stored as a string.
 
 
STRING  mins (A2).
COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
EXECUTE.
 
 
STRING  secs (A2).
COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time) -
CHAR.INDEX(Time,':')).
EXECUTE.
 
 
ALTER TYPE  mins(F2.0).
ALTER TYPE  secs(F2.0).
FORMATS  mins(F2.0).
FORMATS  secs(F2.0).
EXECUTE.
 
COMPUTE  time=TIME.HMS(0, mins, secs).
VARIABLE LABELS  time "".
VARIABLE LEVEL  time (SCALE).
FORMATS  time (TIME8).
VARIABLE WIDTH  time(8).
EXECUTE.
 
------------------------------
 
Date:    Sun, 3 May 2009 13:57:30 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Custom Format Time Variable
 
You are trying to replace values in variable time which is a string with
numeric values in
 
COMPUTE time=TIME.HMS...
 
Although SPSS retains case when storing variable names, comparisons are case
insensitive so Time == time.
 
Change your output variable to some new variable name.
 
-----Original Message-----
From: Brock [mailto:[hidden email]]
Sent: Sunday, May 03, 2009 1:41 PM
To: [hidden email]; ViAnn Beadle
Subject: Re: Custom Format Time Variable
 
This is the syntax I have been running to extract the mins/seconds and try
to create a new variable.  You can see that when the data are read into
SPSS, a time may be:
 
18:46, or
3:20, or
0:17
 
and is originally stored as a string.
 
 
STRING  mins (A2).
COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
EXECUTE.
 
 
STRING  secs (A2).
COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time) -
CHAR.INDEX(Time,':')).
EXECUTE.
 
 
ALTER TYPE  mins(F2.0).
ALTER TYPE  secs(F2.0).
FORMATS  mins(F2.0).
FORMATS  secs(F2.0).
EXECUTE.
 
COMPUTE  time=TIME.HMS(0, mins, secs).
VARIABLE LABELS  time "".
VARIABLE LEVEL  time (SCALE).
FORMATS  time (TIME8).
VARIABLE WIDTH  time(8).
EXECUTE.
 
------------------------------
 
Date:    Sun, 3 May 2009 16:26:45 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable
 
I am sorry, as this is probably much easier than I am making it out to be,
but I am lost.  I am passing three numeric values in the time.hms function,
and that is where I am getting the error stating that I am using an invalid
combination of variables.
 
I looked up the function just to make sure I understood the function
correctly, and it says that it requires numeric values.
 
My apologies, but I guess I do not understand what I am doing incorrectly,
especially since the syntax was generated from the GUI.
 
------------------------------
 
Date:    Sun, 3 May 2009 16:31:51 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable
 
I apologize for the frustration, but I just changed the variable name as you
said.  I was getting hung up on the error message.
 
Thanks,
 
Brock
 
------------------------------
 
Date:    Sun, 3 May 2009 18:18:41 -0400
From:    Art Kendall <[hidden email]>
Subject: Re: Custom Format Time Variable
 
Open a new instance of SPSS.  Copy the syntax below to a syntax file.
Click <run>. Click <all>.
Is this what you are looking for?
 
data list list/ ms_string (a5).
begin data
18:46
3:20
0:17
end data.
string hms_string (a7).
compute hms_string = concat('0:',ms_string).
compute timelapse= number(hms_string,time7.0).
format timelapse(time7).
list.
 
Art Kendall
Social Research Consultants
 
 
 
Brock wrote:
> This is the syntax I have been running to extract the mins/seconds and try
> to create a new variable.  You can see that when the data are read into
> SPSS, a time may be:
> 
> 18:46, or
> 3:20, or
> 0:17
> 
> and is originally stored as a string.
> 
> 
> STRING  mins (A2).
> COMPUTE mins=CHAR.SUBSTR(Time,1,CHAR.INDEX(Time,':')-1).
> EXECUTE.
> 
> 
> STRING  secs (A2).
> COMPUTE secs=CHAR.SUBSTR(Time,CHAR.INDEX(Time,':')+1,length(Time)
-
> CHAR.INDEX(Time,':')).
> EXECUTE.
> 
> 
> ALTER TYPE  mins(F2.0).
> ALTER TYPE  secs(F2.0).
> FORMATS  mins(F2.0).
> FORMATS  secs(F2.0).
> EXECUTE.
> 
> COMPUTE  time=TIME.HMS(0, mins, secs).
> VARIABLE LABELS  time "".
> VARIABLE LEVEL  time (SCALE).
> FORMATS  time (TIME8).
> VARIABLE WIDTH  time(8).
> EXECUTE.
> 
> =====================
> 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
> 
> 
 
------------------------------
 
Date:    Sun, 3 May 2009 18:37:23 -0400
From:    Brock <[hidden email]>
Subject: Re: Custom Format Time Variable
 
Thanks for your help!  For me, all I did was change the variable name from
"time" to something else.
 
- Brock
 
------------------------------
 
Date:    Sun, 3 May 2009 16:24:47 -0500
From:    Jim Arnold <[hidden email]>
Subject: Remove values in several hundred consecutive varaibles
 
--001485f99c7eda0bdb046908ac61
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
 
Hello List,
I am attempting to delete the values in a consecutive series of variables
(several thousand of them) using the following syntax:
 
do if comp ne 1.
do repeat clear = Q1 to D7.
compute clear = $sysmis.
end repeat.
end if.
exe.
 
I am rather new with SPSS syntax so I'm guessing there's something very
fundamental at work here that's causing the problem.  The above code runs
but it does not do as I need.  Values are not cleared from the variables
from Q1 to D7.  What am I missing here?
 
--001485f99c7eda0bdb046908ac61
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
 
Hello List,<div><br></div><div>I am attempting to
delete the values in a co=
nsecutive series of variables (several thousand of them) using the followin=
g syntax:</div><div><br></div><div>do if comp ne
1.</div><div>do repeat cle=
ar =3D Q1 to D7.</div>
<div>compute clear =3D $sysmis.</div><div>end
repeat.</div><div>end if.</di=
v><div>exe.</div><div><br></div><div>I
am rather new with SPSS syntax so I&=
#39;m guessing there&#39;s something very fundamental at work here
that&#39=
;s causing the problem. =A0The above code runs but it does not do as I need=
. =A0Values are not cleared from the variables from Q1 to D7. =A0What am I =
missing here?</div>
 
--001485f99c7eda0bdb046908ac61--
 
------------------------------
 
Date:    Sun, 3 May 2009 18:47:37 -0600
From:    ViAnn Beadle <[hidden email]>
Subject: Re: Remove values in several hundred consecutive varaibles
 
This is a multipart message in MIME format.
 
------=_NextPart_000_0005_01C9CC1F.A2755220
Content-Type: text/plain;
        charset="us-ascii"
Content-Transfer-Encoding: 7bit
 
What is your goal?
 
 
 
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jim
Arnold
Sent: Sunday, May 03, 2009 3:25 PM
To: [hidden email]
Subject: Remove values in several hundred consecutive varaibles
 
 
 
Hello List,
 
 
 
I am attempting to delete the values in a consecutive series of variables
(several thousand of them) using the following syntax:
 
 
 
do if comp ne 1.
 
do repeat clear = Q1 to D7.
 
compute clear = $sysmis.
 
end repeat.
 
end if.
 
exe.
 
 
 
I am rather new with SPSS syntax so I'm guessing there's something very
fundamental at work here that's causing the problem.  The above code runs
but it does not do as I need.  Values are not cleared from the variables
from Q1 to D7.  What am I missing here?
 
 
------=_NextPart_000_0005_01C9CC1F.A2755220
Content-Type: text/html;
        charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
 
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">
 
<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered
medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>
 
<body lang=3DEN-US link=3Dblue vlink=3Dpurple>
 
<div class=3DSection1>
 
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>What is your
goal?<o:p></o:p></span></p>
 
<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>
 
<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0in 0in 0in'>
 
<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
SPSSX(r) =
Discussion
[mailto:[hidden email]] <b>On Behalf Of </b>Jim
Arnold<br>
<b>Sent:</b> Sunday, May 03, 2009 3:25 PM<br>
<b>To:</b> [hidden email]<br>
<b>Subject:</b> Remove values in several hundred consecutive =
varaibles<o:p></o:p></span></p>
 
</div>
 
<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>
 
<p class=3DMsoNormal>Hello List,<o:p></o:p></p>
 
<div>
 
<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>I am attempting to delete the values in a =
consecutive series
of variables (several thousand of them) using the following =
syntax:<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>do if comp ne 1.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>do repeat clear =3D Q1 to
D7.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>compute clear =3D
$sysmis.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>end repeat.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>end if.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>exe.<o:p></o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>
 
</div>
 
<div>
 
<p class=3DMsoNormal>I am rather new with SPSS syntax so I'm guessing
=
there's
something very fundamental at work here that's causing the problem. =
&nbsp;The
above code runs but it does not do as I need. &nbsp;Values are not =
cleared from
the variables from Q1 to D7. &nbsp;What am I missing =
here?<o:p></o:p></p>
 
</div>
 
</div>
 
</body>
 
</html>
 
------=_NextPart_000_0005_01C9CC1F.A2755220--
 
------------------------------
 
End of SPSSX-L Digest - 2 May 2009 to 3 May 2009 (#2009-124)
************************************************************