Hi,
just a little question regarding value labels. Is it possbible to delete a specific value label from a lot of variables according to the text/label ? For example delete all value labels with 'no answer' in it? Thank you! |
Emma Not quite sure what you want, or why you would want to do it, but: 1: open the data editor 2: click on the column header for VALUES to highlight the whole column 3: CTRL+H (Find and replace) 4: Fill in dialog boxes with: Find no answer Replace with <leave box empty> Replace all. Try it with a copy first! 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----- Hi, just a little question regarding value labels. Is it possbible to delete a specific value label from a lot of variables according to the text/label ? For example delete all value labels with 'no answer' in it? Thank you! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Deleting-specific-value-labels-tp5729847.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 |
Emma, you possibly want to remove empty categories from table outputs? CTABLES offers the possibility to exclude them via subcommand /CATEGORIES VARIABLES= varlist EMPTY = EXCLUDE GL, Mario John F Hall <[hidden email]> schrieb am 11:54 Mittwoch, 17.Juni 2015: Emma Not quite sure what you want, or why you would want to do it, but: 1: open the data editor 2: click on the column header for VALUES to highlight the whole column 3: CTRL+H (Find and replace) 4: Fill in dialog boxes with: Find no answer Replace with <leave box empty> Replace all. Try it with a copy first! 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 emma78 Sent: 17 June 2015 10:59 To: [hidden email] Subject: Deleting specific value labels Hi, just a little question regarding value labels. Is it possbible to delete a specific value label from a lot of variables according to the text/label ? For example delete all value labels with 'no answer' in it? Thank you! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Deleting-specific-value-labels-tp5729847.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
Mario Giesel
Munich, Germany |
In reply to this post by emma78
This little program will search all the
variables, look at their value labels, and delete the "no answer"
label if present. For simplicity, I assumed that this label could
occur only once for each variable, but that can be adjusted if needed.
begin program. import spss, spssaux vardict = spssaux.VariableDict() for v in vardict: vallbls = v.ValueLabels for k, vl in vallbls.items(): if vl == "no answer": del(vallbls[k]) v.ValueLabels = vallbls break end program. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: emma78 <[hidden email]> To: [hidden email] Date: 06/17/2015 02:59 AM Subject: [SPSSX-L] Deleting specific value labels Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi, just a little question regarding value labels. Is it possbible to delete a specific value label from a lot of variables according to the text/label ? For example delete all value labels with 'no answer' in it? Thank you! -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Deleting-specific-value-labels-tp5729847.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 |
Perfect, thank you all!
|
Just curious. Why would you want to do this? It is usually good practice to distinguish values that are missing for different reasons.
Art Kendall
Social Research Consultants |
Nobody has a value for those value label, We have special crossheadings in our online suvey which unfortunately generates codes but nobody can click on those ;)
John , one last question: What would it look like, if I wnat to search for a empty label? I tried none, blank but that doesn't seem to work. Thank you! begin program. import spss, spssaux vardict = spssaux.VariableDict() for v in vardict: vallbls = v.ValueLabels for k, vl in vallbls.items(): if vl == "no answer": del(vallbls[k]) v.ValueLabels = vallbls break end program. |
Try
if vl == "<none>": Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: emma78 <[hidden email]> To: [hidden email] Date: 06/18/2015 06:26 AM Subject: Re: [SPSSX-L] Deleting specific value labels Sent by: "SPSSX(r) Discussion" <[hidden email]> Nobody has a value for those value label, We have special crossheadings in our online suvey which unfortunately generates codes but nobody can click on those ;) John , one last question: What would it look like, if I wnat to search for a empty label? I tried none, blank but that doesn't seem to work. Thank you! begin program. import spss, spssaux vardict = spssaux.VariableDict() for v in vardict: vallbls = v.ValueLabels for k, vl in vallbls.items(): if vl == "no answer": del(vallbls[k]) v.ValueLabels = vallbls break end program. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/Deleting-specific-value-labels-tp5729847p5729860.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 |
hm, that doesn't work
I try this but nothing happened;-) begin program. import spss, spssaux vardict = spssaux.VariableDict() for v in vardict: vallbls = v.ValueLabels for k, vl in vallbls.items(): if vl == "<none>": del(vallbls[k]) v.ValueLabels = vallbls break end program. in the value label viewer it looks like 1 "fdsf" 2 "" |
Free forum by Nabble | Edit this page |