Find decimal ASCII code point for character in SPSS

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

Find decimal ASCII code point for character in SPSS

Ruben Geert van den Berg
Dear all,

Is there a way to turn a character into its decimal ASCII code point in SPSS? (For now I'll presume there will be no non ASCII characters present.) I found

formats [...] (ahex).

displays the code point in hexadecimal notation but that's just not the same...

TIA!
Reply | Threaded
Open this post in threaded view
|

Re: Find decimal ASCII code point for character in SPSS

MaxJasper

Just switch SPSS view to Variables and click switch Ascii to numberical J

 

Is there a way to turn a character into its decimal ASCII code point in SPSS? (For now I'll presume there will be no non ASCII characters present.) I found

formats [...] (ahex).

displays the code point in hexadecimal notation but that's just not the same...

TIA!

Reply | Threaded
Open this post in threaded view
|

Re: Find decimal ASCII code point for character in SPSS

David Marso
Administrator
In reply to this post by Ruben Geert van den Berg
Maybe you are referring to PIB format?
----
Ruben Geert van den Berg wrote
Dear all,

Is there a way to turn a character into its decimal ASCII code point in SPSS? (For now I'll presume there will be no non ASCII characters present.) I found

formats [...] (ahex).

displays the code point in hexadecimal notation but that's just not the same...

TIA!
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Find decimal ASCII code point for character in SPSS

David Marso
Administrator
DATA LIST /lower01 TO lower26 upper01 TO upper26 num0 TO num9 (62A1).
BEGIN DATA
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
END DATA.
VARSTOCASES /MAKE char FROM lower01 TO num9 /INDEX=alpha(char).
COMPUTE code=NUMBER(char,PIB).
FORMATS code (PIB).
EXECUTE.
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?"
Reply | Threaded
Open this post in threaded view
|

Re: Find decimal ASCII code point for character in SPSS

Ruben Geert van den Berg
Yes, that's exactly it. I knew it worked the other way around as in

string char(a1).
compute char = string(code,pib).

but - until a minute ago - I didn't know how to reverse that.

Thanks man!
Reply | Threaded
Open this post in threaded view
|

Re: Find decimal ASCII code point for character in SPSS

David Marso
Administrator
In reply to this post by MaxJasper
Where exactly is this "switch Ascii to numerical (sic)"
MaxJasper wrote
Just switch SPSS view to Variables and click switch Ascii to numberical :)

 

Is there a way to turn a character into its decimal ASCII code point in SPSS? (For now I'll presume there will be no non ASCII characters present.) I found

formats [...] (ahex).

displays the code point in hexadecimal notation but that's just not the same...

TIA!
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?"