Measurement levels change during run time

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

Measurement levels change during run time

John F Hall

I have some large files (N > 50,000, V > 1000) from the UK Understanding Society survey, which, when opened, display measurement levels as Unknown or Scale, with a few Nominal thrown in, presumably automatically assigned by SPSS.  I do some other work and go back to the files to find that the levels are now displayed as Nominal or Scale, (none as Ordinal or Unknown) but seemingly also automatically assigned.  Why is this?

 

This is embarrassing as I have claimed in public that the files do not have level properly assigned,  They probably don’t, but I’d like to be sure.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

  

  

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Measurement levels change during run time

Jon K Peck
Statistics assigns measurement levels on the first data pass based on a set of heuristics if the measurement level is unknown.  Go to Edit > Options > Data and click Help to see the exact rules.

You can, of course, assign levels manually with VARIABLE LEVEL syntax or Data > Set Measurement Level for Unknown or get suggestions based on the heuristics via Data > Define Variable Properties under Suggest.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email],
Date:        10/13/2013 05:44 AM
Subject:        [SPSSX-L] Measurement levels change during run time
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




I have some large files (N > 50,000, V > 1000) from the UK Understanding Society survey, which, when opened, display measurement levels as Unknown or Scale, with a few Nominal thrown in, presumably automatically assigned by SPSS.  I do some other work and go back to the files to find that the levels are now displayed as Nominal or Scale, (none as Ordinal or Unknown) but seemingly also automatically assigned.  Why is this?

 

This is embarrassing as I have claimed in public that the files do not have level properly assigned,  They probably don’t, but I’d like to be sure.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   johnfhall@...  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

 

 

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Measurement levels change during run time

John F Hall

Jon

 

Suspected as much.

 

What I’ve done so far with Understanding Society:

 

SPSS files

 

Copied 4 of the original 31 files as:

 

a_ indresp2.sav

a_youth2.sav

b_ indresp2.sav

b_youth2.sav

 

All first letters of variable and value labels changed to upper case with your brilliant Python code.


title "Jon Peck's Python code ".

 

/* Changes first letters of all variable and value labels from lower to upper case.

 

begin program.

import spss, spssaux

vd = spssaux.VariableDict()

for v in vd:

    varlabel = v.VariableLabel

    if varlabel:

        v.VariableLabel = varlabel.capitalize()

    vallbls = v.ValueLabels

    for k in vallbls:

        vallbls[k] = vallbls[k].capitalize()

    if vallbls:

        v.ValueLabels = vallbls

end program.


 

Some files throw up warnings when very long labels are encountered (probably to do with embedded punctuation or quotation marks) but these can be ignored as the labels get changed anyway.

 

Missing values declared using:

 

missing values

    <var to var>

    (-9 thru -1).

 

but not yet checked.

 

Specifying measurement levels will take longer as they seem not to have been assigned at all or have been automatically assigned by SPSS depending on the range of values encountered. 

 

a_ indresp2.sav            Scale except for a_pno and a_sex (both Nominal)

a_youth2.sav                All Unknown

b_ indresp2.sav            All Unknown

b_youth2.sav                All Unknown, but one or two Nominals

(b_pno b_ypsex b_hhorig b_country b_gor_dv

b_mnpno b_fnpno b_mnspno b_fnspno)

`

Assembling variable lists for each measurement level will be a tedious task, but needs doing. 

 

I’ll do this with:

 

variable level

            <var to var> (nominal)

            <var to var>(ordinal)

            <var to var>(scale).

 

I might even try

 

Data > Define Variable Properties

 

. . to see what syntax it throws up, but the dialog box doesn’t always respond to Click or  [SHIFT]Click when selecting variables to move across.  It’s sometimes quicker to copy/paste from the Name column of the Data Editor direct to syntax, especially now that 22 doesn’t need initial spaces for each line after a command.  Ungainly, but it works (and saves time).

 

Of course all this is otiose if the Stata files have properly specified properties and can be read by SPSS, but I don’t know which version of Stata was used (and I don’t have Stata anyway).

 

Many thanks for all your help on this and other surveys.  Although the excellent documentation for these is extensive and thorough, the new files and associated intro will constitute a major resource for researchers, students and teachers who use SPSS rather than Stata, particularly when encountering the surveys for the first time.

 

At least it only has to be done once, but not today as I have a recorded Rolling Stones concert (Hyde Park 2013) to watch and episode 2 of Homeland is on later (somewhat behind you I gather).

 

John

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

  

  

 

 

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck
Sent: 13 October 2013 14:56
To: [hidden email]
Subject: Re: Measurement levels change during run time

 

Statistics assigns measurement levels on the first data pass based on a set of heuristics if the measurement level is unknown.  Go to Edit > Options > Data and click Help to see the exact rules.

You can, of course, assign levels manually with VARIABLE LEVEL syntax or Data > Set Measurement Level for Unknown or get suggestions based on the heuristics via Data > Define Variable Properties under Suggest.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email],
Date:        10/13/2013 05:44 AM
Subject:        [SPSSX-L] Measurement levels change during run time
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





I have some large files (N > 50,000, V > 1000) from the UK Understanding Society survey, which, when opened, display measurement levels as Unknown or Scale, with a few Nominal thrown in, presumably automatically assigned by SPSS.  I do some other work and go back to the files to find that the levels are now displayed as Nominal or Scale, (none as Ordinal or Unknown) but seemingly also automatically assigned.  Why is this?

 

This is embarrassing as I have claimed in public that the files do not have level properly assigned,  They probably don’t, but I’d like to be sure.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email]  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

 

 

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: [Quantitative Methods Teaching] Measurement levels change during run time

Martyn Chamberlain
Thanks John. Hope you manage to catch up with Homeland - excellent series! 
Best
Marty

Sent from my iPhone

On 13 Oct 2013, at 19:25, "John F Hall" <[hidden email]> wrote:

Jon

 

Suspected as much.

 

What I’ve done so far with Understanding Society:

 

SPSS files

 

Copied 4 of the original 31 files as:

 

a_ indresp2.sav

a_youth2.sav

b_ indresp2.sav

b_youth2.sav

 

All first letters of variable and value labels changed to upper case with your brilliant Python code.


title "Jon Peck's Python code ".

 

/* Changes first letters of all variable and value labels from lower to upper case.

 

begin program.

import spss, spssaux

vd = spssaux.VariableDict()

for v in vd:

    varlabel = v.VariableLabel

    if varlabel:

        v.VariableLabel = varlabel.capitalize()

    vallbls = v.ValueLabels

    for k in vallbls:

        vallbls[k] = vallbls[k].capitalize()

    if vallbls:

        v.ValueLabels = vallbls

end program.


 

Some files throw up warnings when very long labels are encountered (probably to do with embedded punctuation or quotation marks) but these can be ignored as the labels get changed anyway.

 

Missing values declared using:

 

missing values

    <var to var>

    (-9 thru -1).

 

but not yet checked.

 

Specifying measurement levels will take longer as they seem not to have been assigned at all or have been automatically assigned by SPSS depending on the range of values encountered. 

 

a_ indresp2.sav            Scale except for a_pno and a_sex (both Nominal)

a_youth2.sav                All Unknown

b_ indresp2.sav            All Unknown

b_youth2.sav                All Unknown, but one or two Nominals

(b_pno b_ypsex b_hhorig b_country b_gor_dv

b_mnpno b_fnpno b_mnspno b_fnspno)

`

Assembling variable lists for each measurement level will be a tedious task, but needs doing. 

 

I’ll do this with:

 

variable level

            <var to var> (nominal)

            <var to var>(ordinal)

            <var to var>(scale).

 

I might even try

 

Data > Define Variable Properties

 

. . to see what syntax it throws up, but the dialog box doesn’t always respond to Click or  [SHIFT]Click when selecting variables to move across.  It’s sometimes quicker to copy/paste from the Name column of the Data Editor direct to syntax, especially now that 22 doesn’t need initial spaces for each line after a command.  Ungainly, but it works (and saves time).

 

Of course all this is otiose if the Stata files have properly specified properties and can be read by SPSS, but I don’t know which version of Stata was used (and I don’t have Stata anyway).

 

Many thanks for all your help on this and other surveys.  Although the excellent documentation for these is extensive and thorough, the new files and associated intro will constitute a major resource for researchers, students and teachers who use SPSS rather than Stata, particularly when encountering the surveys for the first time.

 

At least it only has to be done once, but not today as I have a recorded Rolling Stones concert (Hyde Park 2013) to watch and episode 2 of Homeland is on later (somewhat behind you I gather).

 

John

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

  

  

 

 

 

 

 

 

From: SPSSX(r) Discussion [[hidden email]] On Behalf Of Jon K Peck
Sent: 13 October 2013 14:56
To: [hidden email]
Subject: Re: Measurement levels change during run time

 

Statistics assigns measurement levels on the first data pass based on a set of heuristics if the measurement level is unknown.  Go to Edit > Options > Data and click Help to see the exact rules.

You can, of course, assign levels manually with VARIABLE LEVEL syntax or Data > Set Measurement Level for Unknown or get suggestions based on the heuristics via Data > Define Variable Properties under Suggest.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        John F Hall <[hidden email]>
To:        [hidden email],
Date:        10/13/2013 05:44 AM
Subject:        [SPSSX-L] Measurement levels change during run time
Sent by:        "SPSSX(r) Discussion" <[hidden email]>





I have some large files (N > 50,000, V > 1000) from the UK Understanding Society survey, which, when opened, display measurement levels as Unknown or Scale, with a few Nominal thrown in, presumably automatically assigned by SPSS.  I do some other work and go back to the files to find that the levels are now displayed as Nominal or Scale, (none as Ordinal or Unknown) but seemingly also automatically assigned.  Why is this?

 

This is embarrassing as I have claimed in public that the files do not have level properly assigned,  They probably don’t, but I’d like to be sure.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email]  

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/spss-without-tears.html

 

 

 

 

 

 

 

_______________________________________________

NCRM Quantitative Methods Teaching mailing list
[hidden email]

Email: [hidden email] to unsubscribe or [hidden email] to subscribe