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 (November 2004)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 1 Nov 2004 12:11:43 -0500
Reply-To:     Art@DrKendall.org
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Art Kendall <Arthur.Kendall@verizon.net>
Organization: Social Research Consultants
Subject:      Re: I need help recoding
Comments: To: Sherlock Grigsby <sherlockgrigsby@yahoo.com>
In-Reply-To:  <20041101153306.37010.qmail@web11206.mail.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Neither DO REPEAT nor VECTOR will take a list of variables of mixed numeric and string variables.

Save all your current work, then open a new instance of SPSS. Cut-and-paste then run the syntax at the end of this message. Does this do what you want? If not please restate your question in more detail. Or since it is local, give me a call.

Hope this helps.

Art Art@DrKendall.org Social Research Consultants University Park, MD USA (301) 864-5570

data list free /id (n3) chrg1cat(a10) chrg1num (f1) chrg1nam(a10) chrg1att(f1) chrg1typ (f1) chrg2cat(a10) chrg2num (f1) chrg2nam(a10) chrg2att(f1) chrg2typ (f1) adjcat (a10) adjnum (f1) adjnam (a10) adjatt (f1) adjtyp (f1) adjfirst (f1) adjsec (f1). begin data 004 'blue' 1 'berry' 6 7 'house' 1 'party' 3 3 'tent' 2 'pole' 4 4 0 0 001 'blue' 1 'berry' 3 5 'blue' 1 'berry' 3 1 'blue' 1 'berry' 3 5 1 0 002 'green' 1 'grape' 4 4 'blue' 1 'berry' 5 5 'green' 1 'grape' 1 1 0 1 003 'blue' 1 'berry' 6 7 'house' 1 'party' 3 3 'tent' 2 'pole' 4 4 1 1 end data. string adjcat2 adjnam2 (a10). numeric adjnum2 adjatt2 adjtyp2.

do if adjfirst eq 0 and adjsec eq 0. compute adjcat2 = adjcat. compute adjnum2 = adjnum. compute adjnam2 = adjnam. compute adjatt2 = adjatt. compute adjtyp2 = adjtyp.

else if adjfirst eq 1 and adjsec eq 0. compute adjcat2 = chrg1cat. compute adjnum2 = chrg1num. compute adjnam2 = chrg1nam. compute adjatt2 = chrg1att. compute adjtyp2 = chrg1typ.

else if adjfirst eq 0 and adjsec eq 1. compute adjcat2 = chrg2cat. compute adjnum2 = chrg2num. compute adjnam2 = chrg2nam. compute adjatt2 = chrg2att. compute adjtyp2 = chrg2typ.

else if adjfirst eq 1 and adjsec eq 0. print // 'oops asked for both first and second ID = ' id. end if.

print /id /' ' chrg1cat chrg1num chrg1nam chrg1att chrg1typ /' ' chrg2cat chrg2num chrg2nam chrg2att chrg2typ /' ' adjcat adjnum adjnam adjatt adjtyp /' ' adjfirst adjsec /' ' adjcat2 adjnum2 adjnam2 adjatt2 adjtyp2.

execute.

Sherlock Grigsby wrote:

>I have a data set where I need to swap and replace some values. My data set has three charges within each case, and a series of variables pertaining to each charge. > >Charge 1 variables: chrg1cat, chrch1num, chrg1nam, chrg1att, chrg1typ > >Charge 2 variables: chrg2cat, chrg2num, chrg2nam, chrg2att, chrg2typ > > >Adjudicated Charge variables: adjcat, adjnum, adjnam, adjatt, adjtyp > >In addition there are two variables: "adjfirst" and "adjsec" where if either is selected, Adjudicated Charge variables use the same values as the corresponding variable selected from the two. Ie, If "adjfirst" is selected, all variables from charge 1 should be entered into adjudicated charge variables. Or if adjsec is selected then all values from charge 2 should be entered into adjudicated charges variables. > >My problem is that within my data set I need to switch charge 1 and charge 2 information for a number of the cases as well as the adjudicated charge information where applicable. Can anyone help me with the syntax for this task? Thanks! > > > > >Sherlock Grigsby >Research Associate >Pretrial Services Resource Center >Washington, DC > > >--------------------------------- >Do you Yahoo!? >Yahoo! Mail Address AutoComplete - You start. We finish. > > > >


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