I recently had messages to this list rejected as duplicates. I sent one with subject Problems with 24 http://spssx-discussion.1045642.n5.nabble.com/Problems-with-24-td5732161.html#none but it’s not on that thread. In fact the rejected one appears on thread http://spssx-discussion.1045642.n5.nabble.com/Problems-with-24-td5732161i20.html#a5732221. Just to make sure, I think I have found a solution to the phantom label problem (labels for positive values recoded to negative remain as phantoms and appear in ellipses when clicking on a cell in the Values column). value labels <varlist> “ “. Click on cell under Values for any variable: ellipse will display: {-9769313486231570000000000000000000 . . . } 1: Run StatTransfer on existing *.sav file to get metadata 2: Select syntax for value labels command 3: Edit syntax to remove value labels for positive missing values recoded to negative. 4: Run amended syntax: value labels <varlist1> <varlabels1> /<varlist2> <varlabels2> /<varlist3> <varlabels3> . Click on cell under Values for any variable: ellipse will display the new labels (no phantoms). Looks drastic and could be risky, but I’ve tested it on a copy of the data and it works. 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 |
IIRC, the original thread concerned trying
to derive data dictionary (metadata) syntax from an existing .sav file,
presumably so you could apply those dictionary attributes to another file.
I did not follow the whole thread. Was there some reason you could not use APPLY DICTIONARY? Rick Oliver Senior Information Developer IBM Business Analytics (SPSS) E-mail: [hidden email] From: John F Hall <[hidden email]> To: [hidden email] Date: 05/25/2016 12:00 AM Subject: Phantom labels [was Problems with 24] Sent by: "SPSSX(r) Discussion" <[hidden email]> I recently had messages to this list rejected as duplicates. I sent one with subject Problems with 24 http://spssx-discussion.1045642.n5.nabble.com/Problems-with-24-td5732161.html#nonebut it’s not on that thread. In fact the rejected one appears on thread http://spssx-discussion.1045642.n5.nabble.com/Problems-with-24-td5732161i20.html#a5732221.
Just to make sure, I think I have found a solution to the phantom label problem (labels for positive values recoded to negative remain as phantoms and appear in ellipses when clicking on a cell in the Values column).
value labels<varlist> “ “.
Click on cell under Values for any variable: ellipse will display: {-9769313486231570000000000000000000 . . . }
1: Run StatTransfer on existing *.sav file to get metadata 2: Select syntax for value labels command 3: Edit syntax to remove value labels for positive missing values recoded to negative. 4: Run amended syntax:
value labels <varlist1> <varlabels1> /<varlist2> <varlabels2> /<varlist3> <varlabels3> .
Click on cell under Values for any variable: ellipse will display the new labels (no phantoms).
Looks drastic and could be risky, but I’ve tested it on a copy of the data and it works.
John F Hall (Mr) [Retired academic survey researcher]
Email: johnfhall@... 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 LISTSERV@...(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
|
In reply to this post by John F Hall
value labels jobcat " ". is not good syntax. The first value after the variable name is the value, but no label was specified. If you are trying to get rid of the value labels, do it as value labels jobcat. or value labels <varlist> but no value. On Tue, May 24, 2016 at 11:00 PM, John F Hall <[hidden email]> wrote:
|
In reply to this post by John F Hall
Thanks for all the suggestions. I also had one or two problems copying text from the StatTransfer output into SPSS syntax. I can use APPLY DICTIONARY later [Rick Oliver] but first I need to get rid of the phantom labels. This could be pointless however, since the file would already be “clean”. It’s possible that I left some text highlighted in the *.sps file [David Marso] so will check. If that’s not the problem, I’ll try running Ctrl+H on a notepad copy instead. I need to make sure that the substitutions are done only on value labels for variables whose positive missing values have already been recoded to negative. I’m running all these as test jobs on a copy of the file which contains only a single case, so there’s no risk of inadvertent deletion. Even then, I can always go back to StatTransfer and create the setup file again. 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 |
Like so:
=====================
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
from os.path import splitext syntax = r"c:\some\syntax.sps" with open(syntax, "rb") as infile, open(splitext(syntax)[0] + _subst.sps", "wb") as outfile: for line in infile: line = line.replace(“ 8 ‘DK’", "') outfile.write(line) Date: Wed, 25 May 2016 18:50:33 +0200 From: [hidden email] Subject: Re: [SPSSX-L] Phantom labels [was Problems with 24] To: [hidden email] Thanks for all the suggestions. I also had one or two problems copying text from the StatTransfer output into SPSS syntax. I can use APPLY DICTIONARY later [Rick Oliver] but first I need to get rid of the phantom labels. This could be pointless however, since the file would already be “clean”. It’s possible that I left some text highlighted in the *.sps file [David Marso] so will check. If that’s not the problem, I’ll try running Ctrl+H on a notepad copy instead. I need to make sure that the substitutions are done only on value labels for variables whose positive missing values have already been recoded to negative. I’m running all these as test jobs on a copy of the file which contains only a single case, so there’s no risk of inadvertent deletion. Even then, I can always go back to StatTransfer and create the setup file again.
John F Hall (Mr) [Retired academic survey researcher]
Email: johnfhall@... Website: www.surveyresearch.weebly.com SPSS start page: www.surveyresearch.weebly.com/1-survey-analysis-workshop
|
Albert-Jan That looks like an interesting bit of (Python?) code. In fact I started over and followed David Marso’s suggestion of working in Notepad instead. As he says, Ctrl+H works in fractions of a second. I’ve got rid of most of the lines where a positive value and value label has a corresponding negative value and label. (There were even one or two non-corresponding examples, the resolution of which warranted a visit to the original files downloaded from UKDS.) As far as possible I’ve kept to the missing values used in the original files, mostly ending in 7, 8 or 9 but there some residuals to tidy up like 9 'UNABLE TO CLASSIFY' and odd ones like 16 'Occup not stated or inadeq described' 17 'Not classifiable' 29 'SK:LOOK AFT HOME '. The use of codes 7, 8, and 9 is descended from the days of 80-column cards: much of the syntax conforms to the early SPSS character limits on names and (for tabulations) labels: it can sometimes be quite contorted and gruesome. 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 |
Free forum by Nabble | Edit this page |