Thread-Topic: [NEWSENDER] - removing spaces from string variables -
Thread-Index: AcvozzezAgT1Q8l5T2WGY8G5XVF1CQAAdKXAACTddYA= Message-ID: <731381DE3AFC7746B3D1804240F70D362E1E903FCB@EXCHSRV> References: A<[hidden email]> <[hidden email]> In-Reply-To: <[hidden email]> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_731381DE3AFC7746B3D1804240F70D362E1E903FCBEXCHSRV_" MIME-Version: 1.0 X-Scanned-By: Digested by UGA Mail Gateway on 128.192.1.75 --_000_731381DE3AFC7746B3D1804240F70D362E1E903FCBEXCHSRV_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Jill, Brian's suggestion should work. Here's another suggestion. I don't know if = this will work but give it a shot Var property_id 01800 03 01 00 0 00 000 711811 01 55 00 54 0 00 0 711812 01 900 03 01 00 000-000 711813 01 900 04 1 00 00 00 711814 Here is the syntax. Please note that var is a string variable. ** STRING curr (a1). LOOP #=3D1 TO LENGTH(var). LOOP #i=3D2 to LENGTH (var)-1. COMPUTE curr=3DSUBSTR(var,#i,1). IF (curr=3D' ') var =3D concat(substr(var,1,#i-1),substr(var,#i+1)). END LOOP. END LOOP. EXECUTE. A.Sackey Kweku, MA (Econ) Assistant Director/Senior Statistician Jackson County Assessment 415 E 12th Street #1M Kansas City, Missouri 64106 816-881-3307 (KC) 816-881-4655 (Indy) ________________________________ From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Da= tes, Brian Sent: Tuesday, March 22, 2011 3:44 PM To: [hidden email] Subject: Re: [NEWSENDER] - removing spaces from string variables - Message = is from an unknown sender I don't know how large your file is, but if you paste the id's into Excel a= nd use the Replace function, your data will be converted to numeric and you= can simply paste the new id's back into the original dataset. ________________________________ From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Ji= ll Adelson Sent: Tuesday, March 22, 2011 3:53 PM To: [hidden email] Subject: [NEWSENDER] - removing spaces from string variables - Message is f= rom an unknown sender We are trying to read an SPSS file into HLM v6. It is not accepting the ID= variables, and we think it is because they are string variables that have = space in them. The space are not in the same column for each case. Does a= nyone know some code that we could use to remove spaces from them? Thank you in advance, Jill -- Jill L. Adelson, Ph.D. Assistant Professor Educational Psychology, Measurement, and Evaluation Program Educational and Counseling Psychology Department College of Education and Human Development University of Louisville --_000_731381DE3AFC7746B3D1804240F70D362E1E903FCBEXCHSRV_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" xmlns=3D"http://ww= w.w3.org/TR/REC-html40"> <head> <meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii"> <meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)"> <!--[if !mso]> <style> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} </style> <![endif]--><o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"Postal= Code"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"State"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"City"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"Street"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"address"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"PlaceType"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"PlaceName"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"place"/> <o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"PersonName"/> <!--[if !mso]> <style> st1\:*{behavior:url(#default#ieooui) } </style> <![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal; font-family:Arial; color:navy;} span.EmailStyle18 {mso-style-type:personal-reply; font-family:Arial; color:navy;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} --> </style> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>Jill,<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>Brian’s suggestion should work. Here’s anoth= er suggestion. I don’t know if this will work but give it a shot <o:p></= o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><b><font size=3D2 color=3Dred face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:red;font-weight:bold'>Var &= nbsp; &nbs= p; &= nbsp; &nb= sp; property_id <o:p></o:p></span></font></b></p> <p class=3DMsoNormal><b><font size=3D2 color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial;color:navy;font-weight:bold'>01= 800 03 01 00 0 00 000 &nbs= p; 711811<o:p></o:p></span></font></b></p> <p class=3DMsoNormal><b><font size=3D2 color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial;color:navy;font-weight:bold'>01= 55 00 54 0 00 0  = ; 711812<o:p></o:p></span></font></b></p> <p class=3DMsoNormal><b><font size=3D2 color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial;color:navy;font-weight:bold'>01= 900 03 01 00 000-000 &= nbsp; 711813<o:p></o:p></span></font></b></p> <p class=3DMsoNormal><b><font size=3D2 color=3Dnavy face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial;color:navy;font-weight:bold'>01= 900 04 1 00 00 00 &nbs= p; 711814<o:p></o:p></span></font></b></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>Here is the syntax. Please note that <b><font color=3Dre= d><span style=3D'color:red;font-weight:bold'>var</span></font> </b>is a string vari= able. <o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>**<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>STRING curr (a1). <o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>LOOP #=3D1 TO LENGTH(var). <o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>LOOP #i=3D2 to LENGTH (var)-1. <o:p></o:p></span></font>= </p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>COMPUTE curr=3DSUBSTR(var,#i,1). <o:p></o:p></span></fon= t></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>IF (curr=3D' ') var =3D concat(substr(var,1,#i-1),substr(var,#i+1)). <o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>END <st1:place w:st=3D"on">LOOP</st1:place>. <o:p></o:p>= </span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>END <st1:place w:st=3D"on">LOOP</st1:place>. <o:p></o:p>= </span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>EXECUTE.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>A.<st1:PersonName w:st=3D"on">Sackey <st1:City w:st=3D"o= n">Kweku</st1:City></st1:PersonName>, <st1:State w:st=3D"on">MA</st1:State> (Econ) </span></font><o:p></o:p>= </p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>Assistant Director/Senior Statistician</span></font><o:p= ></o:p></p> <p class=3DMsoNormal><st1:place w:st=3D"on"><st1:PlaceName w:st=3D"on"><fon= t size=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>Jackson</= span></font></st1:PlaceName><font size=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'> = <st1:PlaceName w:st=3D"on">County</st1:PlaceName></span></font></st1:place><font size=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'> Assessment= </span></font><o:p></o:p></p> <p class=3DMsoNormal><st1:Street w:st=3D"on"><st1:address w:st=3D"on"><font= size=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>415 E 12t= h Street #1</span></font></st1:address></st1:Street><font size=3D2 face=3DArial><s= pan style=3D'font-size:10.0pt;font-family:Arial'>M</span></font><o:p></o:p></p> <p class=3DMsoNormal><st1:place w:st=3D"on"><st1:City w:st=3D"on"><font siz= e=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>Kansas Ci= ty</span></font></st1:City><font size=3D2 face=3DArial><span style=3D'font-size:10.0pt;font-family:Arial'>,= <st1:State w:st=3D"on">Missouri</st1:State> <st1:PostalCode w:st=3D"on">64106</st1:Po= stalCode></span></font></st1:place><o:p></o:p></p> <p class=3DMsoNormal><font size=3D2 face=3DArial><span style=3D'font-size:1= 0.0pt; font-family:Arial'>816-881-3307 (KC) 816-881-4655 (Indy)</span></font><o:p>= </o:p></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <div> <div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz= e=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'> <hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1> </span></font></div> <p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span style=3D'font-si= ze:10.0pt; font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=3D2 face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> SPSSX(r) Discussion [mailto:[hidden email]] <b><span style=3D'font-weight:= bold'>On Behalf Of </span></b>Dates, Brian<br> <b><span style=3D'font-weight:bold'>Sent:</span></b> Tuesday, March 22, 201= 1 3:44 PM<br> <b><span style=3D'font-weight:bold'>To:</span></b> [hidden email]= <br> <b><span style=3D'font-weight:bold'>Subject:</span></b> Re: [NEWSENDER] - removing spaces from string variables - Message is from an unknown sender</= span></font><o:p></o:p></p> </div> <p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span style=3D= 'font-size: 12.0pt'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'>I don’t know how large your file= is, but if you paste the id’s into Excel and use the Replace function, yo= ur data will be converted to numeric and you can simply paste the new id’= ;s back into the original dataset.<o:p></o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span style= =3D'font-size: 10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p> <div> <div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font siz= e=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'> <hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1> </span></font></div> <p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span style=3D'font-si= ze:10.0pt; font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=3D2 face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'> SPSSX(r) Discussion [mailto:[hidden email]] <b><span style=3D'font-weight:= bold'>On Behalf Of </span></b>Jill Adelson<br> <b><span style=3D'font-weight:bold'>Sent:</span></b> Tuesday, March 22, 201= 1 3:53 PM<br> <b><span style=3D'font-weight:bold'>To:</span></b> [hidden email]= <br> <b><span style=3D'font-weight:bold'>Subject:</span></b> [NEWSENDER] - remov= ing spaces from string variables - Message is from an unknown sender</span></fo= nt><o:p></o:p></p> </div> <p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span style=3D= 'font-size: 12.0pt'><o:p> </o:p></span></font></p> <p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D3 face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>We are trying to = read an SPSS file into HLM v6. It is not accepting the ID variables, and we t= hink it is because they are string variables that have space in them. The space are not in the same column for each case. Does anyone know some code that we could use to remove spaces from them?<br> <br> Thank you in advance,<br> Jill<br> <br> -- <br> Jill L. Adelson, Ph.D.<br> Assistant Professor<br> Educational Psychology, Measurement, and Evaluation Program<br> Educational and Counseling Psychology Department<br> <st1:place w:st=3D"on"><st1:PlaceType w:st=3D"on">College</st1:PlaceType> o= f <st1:PlaceName w:st=3D"on">Education</st1:PlaceName></st1:place> and Human Development<br= > <st1:place w:st=3D"on"><st1:PlaceType w:st=3D"on">University</st1:PlaceType= > of <st1:PlaceName w:st=3D"on">Louisville</st1:PlaceName></st1:place><o:p></o:p></span></font= ></p> </div> </body> </html> --_000_731381DE3AFC7746B3D1804240F70D362E1E903FCBEXCHSRV_-- ===================== 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 |
Free forum by Nabble | Edit this page |