convert from letters to numbers

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

convert from letters to numbers

laura liu
Hi all,
 
I imported a set of data from Excel into SPSS. Since the Excel data are in letters, i.e.,a,b,c, the imported SPSS data are also in letters.
 
How could I convert the letters to numbers in SPSS?
 
Thanks,
 
Shujie Liu 
Reply | Threaded
Open this post in threaded view
|

Re: convert from letters to numbers

Bruce Weaver
Administrator
Please provide more information.  E.g., what numbers should a, b, and c become?  Are all 26 letters present?  Do you have both upper and lower case?  

Depending on the situation, AUTORECODE may be what you want.

HTH.

laura liu wrote
Hi all,
 
I imported a set of data from Excel into SPSS. Since the Excel data are in letters, i.e.,a,b,c, the imported SPSS data are also in letters.
 
How could I convert the letters to numbers in SPSS?
 
Thanks,
 
Shujie Liu 
--
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/).
Reply | Threaded
Open this post in threaded view
|

Re: convert from letters to numbers

laura liu
These data are from 5-likert sacle questionnaire. so the letters are a,b,c,d,e.

--- On Mon, 4/16/12, Bruce Weaver <[hidden email]> wrote:

From: Bruce Weaver <[hidden email]>
Subject: Re: convert from letters to numbers
To: [hidden email]
Date: Monday, April 16, 2012, 7:30 PM

Please provide more information.  E.g., what numbers should a, b, and c
become?  Are all 26 letters present?  Do you have both upper and lower case?

Depending on the situation, AUTORECODE may be what you want.

HTH.


laura liu wrote

>
> Hi all,
> Â
> I imported a set of data from Excel into SPSS. Since the Excel data are in
> letters, i.e.,a,b,c, the imported SPSS data are also in letters.
> Â
> How could I convert the letters to numbers in SPSS?
> Â
> Thanks,
> Â
> Shujie LiuÂ
>


-----
--
Bruce Weaver
bweaver@...
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/convert-from-letters-to-numbers-tp5645202p5645250.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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
Reply | Threaded
Open this post in threaded view
|

Re: convert from letters to numbers

John F Hall

Laura

 

As well as AUTORECODE you can substitue your own variable names in the following:

 

From the SPSS data editor click on

 

File > New > Syntax         [opens a new syntax editor]

 

Then write in the syntax editor:

 

recode <v1> to <vn> (‘a’ = 1)(‘b’=2)(‘c’=3)(‘d’=4)(‘e’ = 5) into <newv1> to <newvn> .

freq <newv1> to <newvn> .

 

Click on Run > All

 

If your variables are not contiguous in the file, you’ll have to specify them separately.  It might also help to have a look at section 2.3 Data transformations on my website.  Hope this helps.

 

 

John F Hall (Mr)

 

Email:     [hidden email]

Website: www.surveyresearch.weebly.com

Skype:   surveyresearcher1

Phone:    (+33) (0) 2.33.45.91.47

 

 

 

 

 

 

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of laura liu
Sent: 17 April 2012 07:26
To: [hidden email]
Subject: Re: convert from letters to numbers

 

These data are from 5-likert sacle questionnaire. so the letters are a,b,c,d,e.

--- On Mon, 4/16/12, Bruce Weaver <[hidden email]> wrote:


From: Bruce Weaver <[hidden email]>
Subject: Re: convert from letters to numbers
To: [hidden email]
Date: Monday, April 16, 2012, 7:30 PM

Please provide more information.  E.g., what numbers should a, b, and c
become?  Are all 26 letters present?  Do you have both upper and lower case?

Depending on the situation, AUTORECODE may be what you want.

HTH.


laura liu wrote


>
> Hi all,
> Â
> I imported a set of data from Excel into SPSS. Since the Excel data are in
> letters, i.e.,a,b,c, the imported SPSS data are also in letters.
> Â
> How could I convert the letters to numbers in SPSS?
> Â
> Thanks,
> Â
> Shujie LiuÂ
>


-----
--
Bruce Weaver
bweaver@...
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

NOTE: My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.

--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/convert-from-letters-to-numbers-tp5645202p5645250.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
LISTSERV@... (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

 

Reply | Threaded
Open this post in threaded view
|

Re: convert from letters to numbers

Peter Omondi
In reply to this post by laura liu
You can simply click on transform on the data menu and you will be able to see a short list, click on automatic recode and a dialogue box will appear, click on the variables you want change into value and click on the arrow. Somewhere on the dialogue box you will see a rectangular box indicated new variable, inside that box, type your new variable name and click on add new name and the new variable will be displayed at the end of your SPSS data.
Reply | Threaded
Open this post in threaded view
|

Re: convert from letters to numbers

David Marso
Administrator
In reply to this post by laura liu
Simplest thing would to do a global search/replace in Excel ;-)
In SPSS the following will suffice (or you could use RECODE or AUTORECODE as suggested by others):
data list /s1 to s10 (10A1).
BEGIN DATA
abcdebaccd
ebdcadebac
accbacebdc
abbbcabace
END DATA.
DO REPEAT S=S1 TO S10 / N=N1 TO N10.
COMPUTE N=INDEX('abcde',S).
END REPEAT.
LIST.

S1 S2 S3 S4 S5 S6 S7 S8 S9 S10       N1       N2       N3       N4       N5       N6       N7       N8       N9      N10

a  b  c  d  e  b  a  c  c  d       1.00     2.00     3.00     4.00     5.00     2.00     1.00     3.00     3.00     4.00
e  b  d  c  a  d  e  b  a  c       5.00     2.00     4.00     3.00     1.00     4.00     5.00     2.00     1.00     3.00
a  c  c  b  a  c  e  b  d  c       1.00     3.00     3.00     2.00     1.00     3.00     5.00     2.00     4.00     3.00
a  b  b  b  c  a  b  a  c  e       1.00     2.00     2.00     2.00     3.00     1.00     2.00     1.00     3.00     5.00


Number of cases read:  4    Number of cases listed:  4
laura liu wrote
Hi all,
 
I imported a set of data from Excel into SPSS. Since the Excel data are in letters, i.e.,a,b,c, the imported SPSS data are also in letters.
 
How could I convert the letters to numbers in SPSS?
 
Thanks,
 
Shujie Liu 
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?"
CG
Reply | Threaded
Open this post in threaded view
|

Automatic reply: convert from letters to numbers

CG

I am out of the office until February 15.  For immediate assistance please contact Jessica Jaramillo ([hidden email]). Thank you.