pspp-dev
[Top][All Lists]
Advanced

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

Re: Getting case numbers


From: Ben Pfaff
Subject: Re: Getting case numbers
Date: Fri, 12 Nov 2004 19:06:46 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

John Darrington <address@hidden> writes:

> The examine cmd needs to report  case numbers for extreme values.

Okay...

> I thought that this could be done this way:
>
> for(r = casefile_get_reader (cf);
>     casereader_read (r, &c) ;
>     case_destroy (&c) ) 
> {
>   const double weight = 
>     dict_get_case_weight(default_dict, &c, &bad_weight_warn);
>
>   const union value *val = case_data (&c, var->fv);
>   const int case_no = case_num (&c, var->fv);
>
> }
>
> But case_num doesn't seem to do what I expected (and I was a bit
> surprised that it's defined to return double).  So obviously I'm doing
> it wrong.

case_num() returns the value of a numeric variable within the
given case.  It doesn't have anything to do with numbering cases.

> For a struct ccase , how do I find out its case number ??

It's a pretty rare question so there's no standard way.  You
could count cases as you process them, but that won't correspond
to the input data in any useful way if transformations that drop
cases are in use.  If it turns out to be an important question
then we could provide for some kind of case number that gets
carried through with each case as it gets processed.
-- 
Ben Pfaff 
email: address@hidden
web: http://benpfaff.org




reply via email to

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