LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2010)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 5 Jul 2010 18:27:02 +0200
Reply-To:     John F Hall <johnfhall@orange.fr>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         John F Hall <johnfhall@orange.fr>
Subject:      Re: Syntax to crop variable labels
Comments: To: Albert-Jan Roskam <fomcl@yahoo.com>
Comments: cc: Bruce Weaver <bweaver@lakeheadu.ca>
Content-Type: multipart/alternative;

Albert-Jan

Thanks for this. Art sent me something that almost works, but I really must go and cut the grass before dinner. I'll try your syntax out later while Mrs H is watching Coronation St, East Enders, Coronation St

John ----- Original Message ----- From: Albert-Jan Roskam To: SPSSX-L@LISTSERV.UGA.EDU Sent: Monday, July 05, 2010 6:13 PM Subject: Re: Syntax to crop variable labels

Hi,

Something like this might also do what you want:

set mprint = on. get file = 'c:/program files/spss/employee data.sav'. begin program. import spss, spssaux def truncate_labels(var, maxlen): vardict = spssaux.VariableDict() labels = vardict[var].ValueLabels for k, v in labels.iteritems(): spss.Submit("add value labels %s %s '%s'." % (var, k, v[0:maxlen] + "...")) truncate_labels(var = "jobcat", maxlen = 3) end program.

Cheers!! Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--- On Mon, 7/5/10, Art Kendall <Art@DrKendall.org> wrote:

From: Art Kendall <Art@DrKendall.org> Subject: Re: [SPSSX-L] Syntax to crop variable labels To: SPSSX-L@LISTSERV.UGA.EDU Date: Monday, July 5, 2010, 5:51 PM

copy the syntax below into a syntax window. See if this is what you need. Then try replacing the piece of text in the syntax window between "begin data" and "end data" with the text from the other source. copy the resulting print info into a new syntax window.

data list fixed /item (1x,f3) itemlabel(1x, a70). begin data (614)My assignments don't require using technology (615)School filters or firewalls block websites I need to use (616)Software is not good enough (617)Teachers don't know how to use the technology (618)Teachers limit our technology use (619)There are rules against using technology at my school (620)My school has different computers or software than I am used to end data. print /' ' item '"' itemlabel '"/'. execute.

Art Kendall Social Research Consultants

On 7/5/2010 11:29 AM, John F Hall wrote: I am working on a file constructed by someone else. There are hundreds of variable labels of the following type. Rather than going through and deleting the brackets and their contents manually, is there any syntax to do it for me? Otherwise I'll be at it all night.

TIA

John Hall

(614)My assignments don't require using technology (615)School filters or firewalls block websites I need to use (616)Software is not good enough (617)Teachers don't know how to use the technology (618)Teachers limit our technology use (619)There are rules against using technology at my school (620)My school has different computers or software than I am used to ===================== To manage your subscription to SPSSX-L, send a message to LISTSERV@LISTSERV.UGA.EDU (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


[text/html]


Back to: Top of message | Previous page | Main SPSSX-L page