My Excel file (xlsx) contains more than 1200 columns. I tried to open it using the SPSS version 17.01 but the following error came up: "Error Starting the Java Virtual Machine; unable to open file; "FILE NAME"".
I had no choice but copy/paste all the data from Excel into SPSS. But when I do it, all the variables are changed into string (on variables page). Is there a way to convert multiple string variables into numeric using a single command? Any suggestions would be highly appreciated. Behkami M.D PhD student in Immunology |
SPSS should be able to read the file directly
- maybe your version is too old to support Excel 2007, but you can use
the ALTER TYPE command to change the type of all the variables. The
pasted cells probably contained some nonnumeric values, which forced the
types to be string.
Jon Peck Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: behkami <[hidden email]> To: [hidden email] Date: 07/11/2011 08:55 AM Subject: [SPSSX-L] How to convert multiple string varibles into numeric in SPSS? Sent by: "SPSSX(r) Discussion" <[hidden email]> My Excel file (xlsx) contains more than 1200 columns. I tried to open it using the SPSS version 17.01 but the following error came up: "Error Starting the Java Virtual Machine; unable to open file; "FILE NAME"". I had no choice but copy/paste all the data from Excel into SPSS. But when I do it, all the variables are changed into string (on variables page). Is there a way to convert multiple string variables into numeric using a single command? Any suggestions would be highly appreciated. Behkami M.D PhD student in Immunology -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-convert-multiple-string-varibles-into-numeric-in-SPSS-tp4574076p4574076.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 |
If your SPSS version does not support xlsx, simply save the .xlsx file to .xls in Excel, and then read in the .xls file. Garry Gelade From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jon K Peck SPSS should be able to read the file directly - maybe your version is too old to support Excel 2007, but you can use the ALTER TYPE command to change the type of all the variables. The pasted cells probably contained some nonnumeric values, which forced the types to be string.
|
In reply to this post by behkami
|
Thank you soooooooooo much Albert-Jan. It was really helpful.
|
Administrator
|
In reply to this post by behkami
Hmmm, By chance do you have fieldnames in the first row and picking them up in the "copy/paste"? If so then OF COURSE everything is going to show up as a string.
Have no idea why the "open" failed.
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Hi Behkami, I am not sure if someone had answered you on converting a set of string
variables into numeric question part. Assuming that your data is as follows. 1st scenario: v1 v2 v3 v4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Then the syntax to convert the string numbers, v1 v2 v3 v4, into
numerical variables will be as follows: do repeat x1=n1 to n4 /x2=v1 to v4. compute x1=number(x2,f8). end repeat. exe. The f8 in function of the compute reads the number of string values you
want to convert from the original string variables. 2nd scenario: v1 v2 v3 v4 a a a a a a a a a a a a a a a a recode v1 ('a'=1) into n1. crosstab v1 by n1. You will have to do it one by one by doing a copy and paste of the above
syntax for v2 to v4. This is because it is always a good habit to check your
recode to see if you have recoded all the values from your original variable. Warmest Regards Dorraj Oet > > > behkami wrote: > > > > My Excel file (xlsx) contains more than 1200 columns. I tried to open it > > using the SPSS version 17.01 but the following error came up: "Error > > Starting the Java Virtual Machine; unable to open file; "FILE NAME"". > > I had no choice but copy/paste all the data from Excel into SPSS. But when > > I do it, all the variables are changed into string (on variables page). > > Is there a way to convert multiple string variables into numeric using a > > single command? > > Any suggestions would be highly appreciated. > > > > Behkami M.D > > PhD student in Immunology > > > > > -- > View this message in context: http://spssx-discussion.1045642.n5.nabble.com/How-to-convert-multiple-strin! g-varibles-into-numeric-in-SPSS-tp4574076p4580036.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 |
Free forum by Nabble | Edit this page |