pspp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: your mail


From: Ben Pfaff
Subject: Re: your mail
Date: Mon, 12 Jun 2017 21:28:56 -0700
User-agent: Mutt/1.5.23 (2014-03-12)

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).

On Mon, Jun 12, 2017 at 04:22:47PM -0700, Braxton Alfred wrote:
> 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-----
> From: Ben Pfaff [mailto:address@hidden 
> Sent: June-12-17 1:49 PM
> To: Braxton Alfred
> Cc: address@hidden
> 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.
> 
> On Mon, Jun 12, 2017 at 01:05:28PM -0700, Braxton Alfred wrote:
> > 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-----
> > From: Ben Pfaff [mailto:address@hidden
> > Sent: June-12-17 11:15 AM
> > To: Braxton Alfred
> > Cc: address@hidden
> > Subject: Re: your mail
> > 
> > On Mon, Jun 12, 2017 at 11:11:10AM -0700, Braxton Alfred wrote:
> > > 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.
> > 
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]