Discussion:
your mail
(too old to reply)
Braxton Alfred
2017-06-12 18:11:10 UTC
Permalink
PSPP Users



I have a problem with PSPP and would greatly appreciate some help. I am
using version 0.10.4-g50f7b7 on Windows 7 Pro.

I am trying to do some analyses on medical lab tests which occur at varying
times. I need to have the number of days between tests. DATEDIFF, while
described in the manual, does not work, but even if it did I need to be able
to reference 'date(i) - date(i-k)'. I created a variable 'julian' (the
number of days since 1500 or so) using XDATE.TDAY(date) but cannot VECTORize
it.

This is holding up the whole project and people stop talking and look at me
strangely when I come near.

Marc
Ben Pfaff
2017-06-12 18:15:19 UTC
Permalink
Post by Braxton Alfred
I am trying to do some analyses on medical lab tests which occur at varying
times. I need to have the number of days between tests. DATEDIFF, while
described in the manual, does not work, but even if it did I need to be able
to reference 'date(i) - date(i-k)'. I created a variable 'julian' (the
number of days since 1500 or so) using XDATE.TDAY(date) but cannot VECTORize
it.
This is holding up the whole project and people stop talking and look at me
strangely when I come near.
When you say "DATEDIFF does not work", what do you mean? If you can
explain why it doesn't work, then perhaps we can help. In particular,
if there is a bug in DATEDIFF, then I would like to fix it.

When you say that you cannot put your variable into a vector, what do
you mean? If there's a problem with the VECTOR implementation, then I
would like to fix that too.
Ben Pfaff
2017-06-12 20:48:54 UTC
Permalink
The COMPUTE command that you mention creates a single variable. VECTOR
takes a collection of variables and turns them into an array. You only
have a single variable here (or at least you have only mentioned one
variable), so VECTOR is not going to be useful.

Maybe you are trying to find out the difference in date from one case to
another? If so, then you might really want the LAG function.
Using yhe commands 'COMPUTE Julian = XDATE.TDAY(date)' on the variable
'date' and then 'VECTOR days = julian' followed by 'COMPUTE
days(2)-days(1)' I get the error 'no function or vector named days' My goal
is to have a variable (a vector) of days between events. If you would deal
with that it would be helpful.
I have long given up on DATEDIFF since there is no apparent way to directly
reference the output. It does not work anyway. If I could explain why it
does not work I probably would not need any help.
Marc
-----Original Message-----
Sent: June-12-17 11:15 AM
To: Braxton Alfred
Subject: Re: your mail
Post by Braxton Alfred
I am trying to do some analyses on medical lab tests which occur at
varying times. I need to have the number of days between tests.
DATEDIFF, while described in the manual, does not work, but even if it
did I need to be able to reference 'date(i) - date(i-k)'. I created a
variable 'julian' (the number of days since 1500 or so) using
XDATE.TDAY(date) but cannot VECTORize it.
This is holding up the whole project and people stop talking and look
at me strangely when I come near.
When you say "DATEDIFF does not work", what do you mean? If you can explain
why it doesn't work, then perhaps we can help. In particular, if there is a
bug in DATEDIFF, then I would like to fix it.
When you say that you cannot put your variable into a vector, what do you
mean? If there's a problem with the VECTOR implementation, then I would
like to fix that too.
Ben Pfaff
2017-06-13 04:28:56 UTC
Permalink
PSPP (and SPSS) works with rectangular files, that is, tables where each
row is a case and each column is a variable. VECTOR works across
columns. LAG works across rows.

Try something like this:

COMPUTE julian = XDATE.TDAY(date).
COMPUTE delta = julian - LAG(julian).
Thank you for the reply. I realize I don't understand - I use COMPUTE and
get 1500 values from the single variable date. Using VECTOR why can I not
get 1499 values of the difference in days between date(i) and
date (i-k)?
My manual does not have a command LAG in it, but if it is like the
econometrics lag, it is not what I want. I wantsomething like the Excel
command 'days360' the number of elapsed days between two dates.
-----Original Message-----
Sent: June-12-17 1:49 PM
To: Braxton Alfred
Subject: Re: your mail
The COMPUTE command that you mention creates a single variable. VECTOR
takes a collection of variables and turns them into an array. You only have
a single variable here (or at least you have only mentioned one variable),
so VECTOR is not going to be useful.
Maybe you are trying to find out the difference in date from one case to
another? If so, then you might really want the LAG function.
Using yhe commands 'COMPUTE Julian = XDATE.TDAY(date)' on the variable
'date' and then 'VECTOR days = julian' followed by 'COMPUTE
days(2)-days(1)' I get the error 'no function or vector named days'
My goal is to have a variable (a vector) of days between events. If
you would deal with that it would be helpful.
I have long given up on DATEDIFF since there is no apparent way to
directly reference the output. It does not work anyway. If I could
explain why it does not work I probably would not need any help.
Marc
-----Original Message-----
Sent: June-12-17 11:15 AM
To: Braxton Alfred
Subject: Re: your mail
Post by Braxton Alfred
I am trying to do some analyses on medical lab tests which occur at
varying times. I need to have the number of days between tests.
DATEDIFF, while described in the manual, does not work, but even if
it did I need to be able to reference 'date(i) - date(i-k)'. I
created a variable 'julian' (the number of days since 1500 or so)
using
XDATE.TDAY(date) but cannot VECTORize it.
This is holding up the whole project and people stop talking and
look at me strangely when I come near.
When you say "DATEDIFF does not work", what do you mean? If you can
explain why it doesn't work, then perhaps we can help. In particular,
if there is a bug in DATEDIFF, then I would like to fix it.
When you say that you cannot put your variable into a vector, what do
you mean? If there's a problem with the VECTOR implementation, then I
would like to fix that too.
John Darrington
2017-06-13 04:59:58 UTC
Permalink
My manual does not have a command LAG in it,
The LAG function is documented in Section 7.7.9 of the PSPP manual.

Regards,

J'

PS. When following up a question on the mailing list, please reply *to the list*,
and not as a private email (unless the person has specifically asked you to do that).
--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.
Continue reading on narkive:
Loading...