Discordant value labels

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

Discordant value labels

John F Hall

After running Jon Peck’s Python code to search for variables with value label combinations of  -9 “Don’t know” together with 9 “Not answered” there are thousands of variables listed in the spv:

 

EnvEfLif  -9.0 Don't know

CARSPOL1  9.0 Not answered

CARSPOL1  -9.0 Don't know

INDPOL1  9.0 Not answered

INDPOL1  -9.0 Don't know

PESTCHE1  -9.0 Don't know

WATRPOL1  -9.0 Don't know

 

I need to pull out those that appear twice, once with -9 Don’t know and again with 9 Not Answered.  I copied the list to Notepad and used Ctrl+H to get rid of all the -9 Don’t know labels.  These are correct for the variables involved.  That leaves a list like this:

 

econscrt          

econscrt           9.0 Not answered

mpscare           9.0 Not answered

mpscare          

impgweas         9.0 Not answered

impgweas        

myrdone           9.0 Not answered

myrdone          

myrpower         9.0 Not answered

myrpower        

myrspeak         9.0 Not answered

myrspeak        

 

For whole blocks of names -9 “Don’t know” is the correct label and they can be deleted en bloc, but that leaves thousands of variables for which the 9 “Don’t know” labels are wrong and need to be replaced by -9 “Not answered”.   To do this by hand will take forever: most of them are on alternate lines.  Is there a quick way to delete all lines without 9.0 Not answered? 

 

After that I need to copy the remaining variables into syntax:

 

recode <varlist>

(9=-9)

 

add value labels

<varlist>

 

missing values

<varlist>

(lo thru -1)  Thanks in advance

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

Christopher Stride

copy into excel, sort by the relevant column to get all those rows together, delete block

Excel is your friend in sorting out labels of both types in a manual (non-programming) way


On 09/06/2016 11:55, John F Hall wrote:

After running Jon Peck’s Python code to search for variables with value label combinations of  -9 “Don’t know” together with 9 “Not answered” there are thousands of variables listed in the spv:

 

EnvEfLif  -9.0 Don't know

CARSPOL1  9.0 Not answered

CARSPOL1  -9.0 Don't know

INDPOL1  9.0 Not answered

INDPOL1  -9.0 Don't know

PESTCHE1  -9.0 Don't know

WATRPOL1  -9.0 Don't know

 

I need to pull out those that appear twice, once with -9 Don’t know and again with 9 Not Answered.  I copied the list to Notepad and used Ctrl+H to get rid of all the -9 Don’t know labels.  These are correct for the variables involved.  That leaves a list like this:

 

econscrt          

econscrt           9.0 Not answered

mpscare           9.0 Not answered

mpscare          

impgweas         9.0 Not answered

impgweas        

myrdone           9.0 Not answered

myrdone          

myrpower         9.0 Not answered

myrpower        

myrspeak         9.0 Not answered

myrspeak        

 

For whole blocks of names -9 “Don’t know” is the correct label and they can be deleted en bloc, but that leaves thousands of variables for which the 9 “Don’t know” labels are wrong and need to be replaced by -9 “Not answered”.   To do this by hand will take forever: most of them are on alternate lines.  Is there a quick way to delete all lines without 9.0 Not answered? 

 

After that I need to copy the remaining variables into syntax:

 

recode <varlist>

(9=-9)

 

add value labels

<varlist>

 

missing values

<varlist>

(lo thru -1)  Thanks in advance

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

-- 

--

Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology,
University of Sheffield
Telephone: 0114 2223262
Fax: 0114 2727206

"Figure It Out"
Statistical Consultancy and Training Service for Social Scientists

Visit www.figureitout.org.uk for details of my consultancy services, and
forthcoming training courses, which are also available on an in-house basis:

 - Data management using SPSS syntax
 - Advanced SPSS syntax and SPSS macros
 - Testing for Mediation and Moderation using SPSS
 - Multi-level Modelling using SPSS
 - Introduction to Structural Equation Modelling using Mplus
 - Testing for Mediation and Moderation using Mplus
 - Multi-level Modelling using Mplus
 - Latent Growth Curve Modelling using Mplus 
===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

David Marso
Administrator
In reply to this post by John F Hall
John,
  In what conceivable way is this an SPSS question?
It is really a how do I use my tools to do editing?
Please keep your questions relevant to SPSS/Statistics ...
The Management
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

John F Hall

David

 

That’s the sort of unhelpful remark that makes social researchers reluctant to ask programmers and statisticians for advice and assistance.  It's very much SPSS for me because I'm working on a huge SPSS saved file (10,765 variables: 95,630 cases) and SPSS keeps crashing when I try to edit in syntax.  My flow is: SPSS >> Python >> Excel (to keep the spv output in columns) >> Notepad >>  Ctrl+H to get rid of superfluous labels >> [How get rid of lines with varname only ??] >> SPSS syntax for RECODE, ADD VALUE LABELS, MISSING VALUES.

 

As regards Chris Stride’s advice, I only use Excel for keeping track of personal expenditure, and as an intermediate step for other processes, but investigated using it for sorting (which I’ve never done before).  The original spv output was in a single column and CTRL+H would have deleted all the varnames: ditto for Notepad and syntax.  I’ve just copied the edited Notepad back into Excel and the names and labels were in separate columns.

 

[15 minutes of trial and error later]

In Excel: Sort&Filter >> Custom Sort >> <column>|<values> did exactly what I needed.  All I had to do was copy the second set of variable names into the SPSS syntax file and run it.  Hopefully there won’t be any more huge sets of variables with discordant labels for the same value (one positive, one negative).  Thanks to Chris (and especially Jon Peck) there is now an almost complete and clean beta version of the “mother” cumulative file for all 30 waves of British Social Attitudes 1983 to 2104.  One or two glitches will remain, but they can be dealt with au fur et sur mésure as they say over here.

 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Marso
Sent: 09 June 2016 14:24
To: [hidden email]
Subject: Re: Discordant value labels

 

John,

  In what conceivable way is this an SPSS question?

It is really a how do I use my tools to do editing?

Please keep your questions relevant to SPSS/Statistics ...

The Management

 

 

 

-----

Please reply to the list and not to my personal email.

Those desiring my consulting or training services please feel free to email me.

---

"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."

Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"

--

View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels-tp5732358p5732360.html

Sent from the SPSSX Discussion mailing list archive at Nabble.com.

 

=====================

To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

David Marso
Administrator
But the specific gist of the question
 'How do I delete Blank lines in a Text file' is completely tangential and irrelevant to the purposes of this group.
The notion that because it is a file created by SPSS somehow makes the question an SPSS question?
Put down the beer John.


John F Hall wrote
David
 
That’s the sort of unhelpful remark that makes social researchers
reluctant to ask programmers and statisticians for advice and
assistance.  It's very much SPSS for me because I'm working on a huge
SPSS saved file (10,765 variables: 95,630 cases) and SPSS keeps
crashing when I try to edit in syntax.  My flow is: SPSS >> Python >>
Excel (to keep the spv output in columns) >> Notepad >>  Ctrl+H to get
rid of superfluous labels >> [How get rid of lines with varname only
??] >> SPSS syntax for RECODE, ADD VALUE LABELS, MISSING VALUES.
 
As regards Chris Stride’s advice, I only use Excel for keeping track
of personal expenditure, and as an intermediate step for other
processes, but investigated using it for sorting (which I’ve never
done before).  The original spv output was in a single column and
CTRL+H would have deleted all the varnames: ditto for Notepad and
syntax.  I’ve just copied the edited Notepad back into Excel and the
names and labels were in separate columns.
 
[15 minutes of trial and error later]
In Excel: Sort&Filter >> Custom Sort >> <column>|<values> did exactly
what I needed.  All I had to do was copy the second set of variable
names into the SPSS syntax file and run it.  Hopefully there won’t be
any more huge sets of variables with discordant labels for the same
value (one positive, one negative).  Thanks to Chris (and especially
Jon Peck) there is now an almost complete and clean beta version of
the “mother” cumulative file for all 30 waves of British Social
Attitudes 1983 to 2104.  One or two glitches will remain, but they can
be dealt with au fur et sur mésure as they say over here.
 
John F Hall (Mr)
[Retired academic survey researcher]
 
Email:   [hidden email] <mailto:[hidden email]>  
Website: www.surveyresearch.weebly.com
<http://www.surveyresearch.weebly.com/> 
SPSS start page:
www.surveyresearch.weebly.com/1-survey-analysis-workshop
<http://surveyresearch.weebly.com/1-survey-analysis-workshop.html> 
 
 
 
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf
Of David Marso
Sent: 09 June 2016 14:24
To: [hidden email]
Subject: Re: Discordant value labels
 
John,
  In what conceivable way is this an SPSS question?
It is really a how do I use my tools to do editing?
Please keep your questions relevant to SPSS/Statistics ...
The Management
 
 
 
-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to
email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante
porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum
cliff in abyssum?"
--
View this message in context:
<http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels
-tp5732358p5732360.html>
http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels-
tp5732358p5732360.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
 
=====================
To manage your subscription to SPSSX-L, send a message to
<mailto:[hidden email]> [hidden email] (not to
SPSSX-L), with no body text except the command. To leave the list,
send the command SIGNOFF SPSSX-L For a list of commands to manage
subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

Jon Peck
While I would solve the problems John is grappling with in other ways, it seems to me that these sorts of problems are on topic for this list, so solutions might be of interest to list members.  I would suggest that the posts be more concise and focused, however.

On Thu, Jun 9, 2016 at 11:21 AM, David Marso <[hidden email]> wrote:
But the specific gist of the question
* 'How do I delete Blank lines in a Text file'* is completely tangential and
irrelevant to the purposes of this group.
The notion that because it is a file created by SPSS somehow makes the
question an SPSS question?
Put down the beer John.



John F Hall wrote
> David
>
> That’s the sort of unhelpful remark that makes social researchers
> reluctant to ask programmers and statisticians for advice and
> assistance.  It's very much SPSS for me because I'm working on a huge
> SPSS saved file (10,765 variables: 95,630 cases) and SPSS keeps
> crashing when I try to edit in syntax.  My flow is: SPSS >> Python >>
> Excel (to keep the spv output in columns) >> Notepad >>  Ctrl+H to get
> rid of superfluous labels >> [How get rid of lines with varname only
> ??] >> SPSS syntax for RECODE, ADD VALUE LABELS, MISSING VALUES.
>
> As regards Chris Stride’s advice, I only use Excel for keeping track
> of personal expenditure, and as an intermediate step for other
> processes, but investigated using it for sorting (which I’ve never
> done before).  The original spv output was in a single column and
> CTRL+H would have deleted all the varnames: ditto for Notepad and
> syntax.  I’ve just copied the edited Notepad back into Excel and the
> names and labels were in separate columns.
>
> [15 minutes of trial and error later]
> In Excel: Sort&Filter >> Custom Sort >>
> <column>
> |
> <values>
>  did exactly
> what I needed.  All I had to do was copy the second set of variable
> names into the SPSS syntax file and run it.  Hopefully there won’t be
> any more huge sets of variables with discordant labels for the same
> value (one positive, one negative).  Thanks to Chris (and especially
> Jon Peck) there is now an almost complete and clean beta version of
> the “mother” cumulative file for all 30 waves of British Social
> Attitudes 1983 to 2104.  One or two glitches will remain, but they can
> be dealt with au fur et sur mésure as they say over here.
>
> John F Hall (Mr)
> [Retired academic survey researcher]
>
> Email:

> johnfhall@

>  &lt;mailto:

> johnfhall@

> &gt;
> Website: www.surveyresearch.weebly.com
> &lt;http://www.surveyresearch.weebly.com/&gt;
> SPSS start page:
> www.surveyresearch.weebly.com/1-survey-analysis-workshop
> &lt;http://surveyresearch.weebly.com/1-survey-analysis-workshop.html&gt;
>
>
>
> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:

> SPSSX-L@.UGA

> ] On Behalf
> Of David Marso
> Sent: 09 June 2016 14:24
> To:

> SPSSX-L@.UGA

> Subject: Re: Discordant value labels
>
> John,
>   In what conceivable way is this an SPSS question?
> It is really a how do I use my tools to do editing?
> Please keep your questions relevant to SPSS/Statistics ...
> The Management
>
>
>
> -----
> Please reply to the list and not to my personal email.
> Those desiring my consulting or training services please feel free to
> email me.
> ---
> "Nolite dare sanctum canibus neque mittatis margaritas vestras ante
> porcos ne forte conculcent eas pedibus suis."
> Cum es damnatorum possederunt porcos iens ut salire off sanguinum
> cliff in abyssum?"
> --
> View this message in context:
> &lt;http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels
> -tp5732358p5732360.html&gt;
> http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels-
> tp5732358p5732360.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> &lt;mailto:

> LISTSERV@.UGA

> &gt;

> LISTSERV@.UGA

>  (not to
> SPSSX-L), with no body text except the command. To leave the list,
> send the command SIGNOFF SPSSX-L For a list of commands to manage
> subscriptions, send the command INFO REFCARD
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Discordant-value-labels-tp5732358p5732367.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD



--
Jon K Peck
[hidden email]

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

John F Hall
In reply to this post by John F Hall

Claire Durand, Université de Montréal (via the ASA-Survey Research Methods Section) contacted me about this and is happy to share with the list. She wrote:

 


Interesting,

 

I ran into very problematic errors with version 23 of French SPSS. It looks a bit like yours. It seems it was a problem with encoding although the crash would happen only when I try to perform a logistic regression!

In my case, I manage to solve the error on Windows by changing SPSS encoding to French-Canada. However it seems that the problem comes from the fact that the SPSS file is not well encoded, part of it being UTF-8 and part Windows 1252.

 

I just ran into another problem with my students. They are working with a SPSS file created by STATCAN. This should be ok normally. But as soon as they want to use a certain variable in the logistic regression, it crashes. Good grief. We managed to have it work if we take the english version of the data file and change the encoding to unicode.

Let's notice that ALL these procedures with exactly the same file work fine with SPSS 22. But it is impossible to install SPSS 22 on Windows 10. We also have problems with MAC. Again the encoding for the english file works but with the french file, it crashes. We managed to solve part of the problem by changing the apostrophes!!!

 

But now, all my time is dedicated to solving the problems with SPSS!!!!!!! And my students have to prepare their session paper. I will perhaps have to ask them to go to the labs to do it or use the English file.

 


 

John F Hall (Mr)

[Retired academic survey researcher]

 

Email:   [hidden email] 

Website: www.surveyresearch.weebly.com

SPSS start page:  www.surveyresearch.weebly.com/1-survey-analysis-workshop

 

 

 

===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Discordant value labels

David Marso
Administrator
No comment regarding the localization issues but
"But it is impossible to install SPSS 22 on Windows 10. "
Claire must clarify (pun intended).
I am running 22 with no issues on Windoze 10.x (wtf know what update probably 10.1?)
Spins along like a demon with golden melty wings.


John F Hall wrote
Claire Durand, Université de Montréal (via the ASA-Survey Research
Methods Section) contacted me about this and is happy to share with
the list. She wrote:
 
  _____  

Interesting,
 
I ran into very problematic errors with version 23 of French SPSS. It
looks a bit like yours. It seems it was a problem with encoding
although the crash would happen only when I try to perform a logistic
regression!
In my case, I manage to solve the error on Windows by changing SPSS
encoding to French-Canada. However it seems that the problem comes
from the fact that the SPSS file is not well encoded, part of it being
UTF-8 and part Windows 1252.
 
I just ran into another problem with my students. They are working
with a SPSS file created by STATCAN. This should be ok normally. But
as soon as they want to use a certain variable in the logistic
regression, it crashes. Good grief. We managed to have it work if we
take the english version of the data file and change the encoding to
unicode.
Let's notice that ALL these procedures with exactly the same file work
fine with SPSS 22. But it is impossible to install SPSS 22 on Windows
10. We also have problems with MAC. Again the encoding for the english
file works but with the french file, it crashes. We managed to solve
part of the problem by changing the apostrophes!!!
 
But now, all my time is dedicated to solving the problems with
SPSS!!!!!!! And my students have to prepare their session paper. I
will perhaps have to ask them to go to the labs to do it or use the
English file.
 
  _____  

 
John F Hall (Mr)
[Retired academic survey researcher]
 
Email:   [hidden email] <mailto:[hidden email]>  
Website: www.surveyresearch.weebly.com
<http://www.surveyresearch.weebly.com/> 
SPSS start page:
www.surveyresearch.weebly.com/1-survey-analysis-workshop
<http://surveyresearch.weebly.com/1-survey-analysis-workshop.html> 
 
 
 

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"