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 anyone 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 |
Nevermind - we solved the problem!
In case others have the problem, the syntax is COMPUTE stringname = REPLACE(stringname, " ", ""). Thanks, Jill
On Tue, Mar 22, 2011 at 3:53 PM, Jill Adelson <[hidden email]> wrote: 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 anyone know some code that we could use to remove spaces from them? |
In reply to this post by Jill Adelson-2
I don’t know how large your file is,
but if you paste the id’s into Excel and 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 Jill Adelson 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 anyone know some
code that we could use to remove spaces from them? |
Administrator
|
In reply to this post by Jill Adelson-2
You could use the REPLACE function. E.g.,
data list list / ID (a10). begin data "K Pearson" "ES Pearson" "RF Fisher" "JW Tukey" "GEP Box" end data. string ID_no_spaces IDwith_ (a10). compute ID_no_spaces = replace(ID," ",""). compute IDwith_ = replace(rtrim(ID)," ","_"). list.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Jill Adelson-2
Thanks for cycling the solution back to
everyone, Jill. Brian From: SPSSX(r)
Discussion [mailto:[hidden email]] On
Behalf Of Jill Adelson Nevermind - we solved the
problem! On Tue, Mar 22, 2011 at 3:53 PM, Jill Adelson <[hidden email]> wrote: 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 anyone know some
code that we could use to remove spaces from them? |
Free forum by Nabble | Edit this page |