DisplayDict dictionary values not in order

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

DisplayDict dictionary values not in order

Joel_Rivard
Hi,

 

I'm using the DisplayDict Module on SPSS 14.0.2. and am creating a dictionary. The module is working great as I'm getting the dictionary in the older SPSS style where value labels are intermixed with other variable information.  However, the values aren't in order (from 1 to 12).  See below for the example.

 

Index: 6            Five-year age group of respondent

                        Measurement Level: scale Type: numeric Format: F2.0

                        Missing Values:

                        Value Labels

                        1            15 to 19

                        10           60 to 64

                        11           65 to 69

                        12           70+

                        2            20 to 24

                        3            25 to 29

                        4            30 to 34

                        5            35 to 39

                        6            40 to 44

                        7            45 to 49

                        8            50 to 54

                        9            55 to 59

 

How would I ensure that the values are in order?

 

This is the SPSS syntax that I'm currently using:

 

begin program.

import spss, DisplayDict

DisplayDict.dictionary(alphaorder=False)

end program.

 

Thanks,

Joel                          

 

 

Joël Rivard

Data Technician

Maps, Data & Government Information Centre

Carleton University Library

(613) 520-2600 ext.1685

[hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: DisplayDict dictionary values not in order

Mark Casazza
You actually are getting them in the correct order; the "1" in "12"
should sort before "2".  Try reformatting the variable to N2 format
(rather than your current F2 format).  The N format displays the leading
zeros so then "02" would sort before "12".

HTH,
Mark

Joel_Rivard wrote:

> Hi,
>
>
>
> I'm using the DisplayDict Module on SPSS 14.0.2. and am creating a dictionary. The module is working great as I'm getting the dictionary in the older SPSS style where value labels are intermixed with other variable information.  However, the values aren't in order (from 1 to 12).  See below for the example.
>
>
>
> Index: 6            Five-year age group of respondent
>
>                         Measurement Level: scale Type: numeric Format: F2.0
>
>                         Missing Values:
>
>                         Value Labels
>
>                         1            15 to 19
>
>                         10           60 to 64
>
>                         11           65 to 69
>
>                         12           70+
>
>                         2            20 to 24
>
>                         3            25 to 29
>
>                         4            30 to 34
>
>                         5            35 to 39
>
>                         6            40 to 44
>
>                         7            45 to 49
>
>                         8            50 to 54
>
>                         9            55 to 59
>
>
>
> How would I ensure that the values are in order?
>
>
>
> This is the SPSS syntax that I'm currently using:
>
>
>
> begin program.
>
> import spss, DisplayDict
>
> DisplayDict.dictionary(alphaorder=False)
>
> end program.
>
>
>
> Thanks,
>
> Joel
>
>
>
>
>
> Joël Rivard
>
> Data Technician
>
> Maps, Data & Government Information Centre
>
> Carleton University Library
>
> (613) 520-2600 ext.1685
>
> [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: DisplayDict dictionary values not in order

Peck, Jon
In reply to this post by Joel_Rivard
What you are seeing is the values in the value labels sorted as strings rather than as numbers.  As  a string, one would get the order 1, 10, 2.  As numbers, obviously it would be 1,2,10.

There is a new version of DisplayDict.py on SPSS Developer Central (www.spss.com/devcentral) that sorts the values as numbers if the variable is numeric.  It is version 1.3.1

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joel_Rivard
Sent: Thursday, March 15, 2007 8:40 AM
To: [hidden email]
Subject: [SPSSX-L] DisplayDict dictionary values not in order

Hi,



I'm using the DisplayDict Module on SPSS 14.0.2. and am creating a dictionary. The module is working great as I'm getting the dictionary in the older SPSS style where value labels are intermixed with other variable information.  However, the values aren't in order (from 1 to 12).  See below for the example.



Index: 6            Five-year age group of respondent

                        Measurement Level: scale Type: numeric Format: F2.0

                        Missing Values:

                        Value Labels

                        1            15 to 19

                        10           60 to 64

                        11           65 to 69

                        12           70+

                        2            20 to 24
Reply | Threaded
Open this post in threaded view
|

Re: DisplayDict dictionary values not in order

Joel_Rivard
Thanks Jon,

That did the trick.


Joël Rivard
Data Technician
Maps, Data & Government Information Centre
Carleton University Library
(613) 520-2600 ext.1685
[hidden email]

-----Original Message-----
From: Peck, Jon [mailto:[hidden email]]
Sent: Thursday, March 15, 2007 12:55 PM
To: Joel_Rivard; [hidden email]
Subject: RE: [SPSSX-L] DisplayDict dictionary values not in order

What you are seeing is the values in the value labels sorted as strings rather than as numbers.  As  a string, one would get the order 1, 10, 2.  As numbers, obviously it would be 1,2,10.

There is a new version of DisplayDict.py on SPSS Developer Central (www.spss.com/devcentral) that sorts the values as numbers if the variable is numeric.  It is version 1.3.1

HTH,
Jon Peck

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Joel_Rivard
Sent: Thursday, March 15, 2007 8:40 AM
To: [hidden email]
Subject: [SPSSX-L] DisplayDict dictionary values not in order

Hi,



I'm using the DisplayDict Module on SPSS 14.0.2. and am creating a dictionary. The module is working great as I'm getting the dictionary in the older SPSS style where value labels are intermixed with other variable information.  However, the values aren't in order (from 1 to 12).  See below for the example.



Index: 6            Five-year age group of respondent

                        Measurement Level: scale Type: numeric Format: F2.0

                        Missing Values:

                        Value Labels

                        1            15 to 19

                        10           60 to 64

                        11           65 to 69

                        12           70+

                        2            20 to 24