pspp-users
[Top][All Lists]
Advanced

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

Re: set /format


From: Ben Pfaff
Subject: Re: set /format
Date: Sun, 14 Apr 2013 21:13:46 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Apr 14, 2013 at 09:43:49PM +0200, John Darrington wrote:
> On Sun, Apr 14, 2013 at 12:23:24PM -0700, Ben Pfaff wrote:
>      
>      PSPP and SPSS both document that COMPUTE creates variables with format
>      F8.2.
> 
> I'm not so sure.  An old SPSS manual that I have says 
> 
>  "FORMAT Subcommand
>   FORMAT specifies the default print and write formats for numeric variables. 
> This default format
>   applies to numeric variables that are defined on DATA LIST in freefield 
> format and to all numeric
>   variables that are created by transformation commands (unless a format is 
> explicitly specified)."
> 
> Later it says:
>  "New numeric variables created with COMPUTE are assigned a dictionary format 
> of F8.2 and [...]
>   The format of a numeric variable can be changed with the FORMATS command."
> 
> 
> However PSPP using DATA LIST creates variables with F8.0 regardless of SET 
> FORMAT. It also doesn't
> seem to have any effect on COMPUTE.

You may be misreading the code.  The default input format for free-field
data is F8.0 (which means mainly that there are no implied decimal
places).  The default output format for free-field data is what SET
FORMAT says.  Here's the relevant code from parse_free() in data-list.c:

        {
          lex_match (lexer, T_ASTERISK);
          input = fmt_for_input (FMT_F, 8, 0);
          output = *settings_get_format ();
        }

Confirmation:

    address@hidden:~/pspp/master/_build(0)$ src/ui/terminal/pspp  
    PSPP is free software and you are welcome to distribute copies of it
    under certain conditions; type "show copying." to see the conditions.
    There is ABSOLUTELY NO WARRANTY for PSPP; type "show warranty." for details.
    GNU pspp 0.7.10 (Wed Apr 10 21:32:22 PDT 2013).
    PSPP> data list free /x.
    PSPP> begin data.
    data> 1
    data> end data.
    PSPP> display dictionary.
    +--------+----------------+--------+
    |Variable|Description     |Position|
    #========#================#========#
    |x       |Format: F8.2    |       1|
    |        |Measure: Scale  |        |
    |        |Display         |        |
    |        |Alignment: Right|        |
    |        |Display Width: 8|        |
    +--------+----------------+--------+

It looks to me like the SPSS documentation is inconsistent.  I would
really like to hear from an SPSS user whether SET FORMAT affects the
formats of variables created by DATA LIST FREE, COMPUTE, IF, and RECODE,
and then change PSPP (as necessary) to do the same thing.

Thanks,

Ben.



reply via email to

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