BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Mike_Davis
Fluorite | Level 6


Hello everyone,

I have a data set  has a hexadecimal variable,I want to convert it  into character,please advise.(for example 6B should convert to k)

for your reference,the following website list the ralationship of hex and character.

http://www.asciitable.com/

Thanks

Mike.

data have;

input hex $;

cards;

4D

4F

76

20

28

6B

;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
MikeZdeb
Rhodochrosite | Level 12

hi ...

data have;

input hex $;

cards;

4D

4F

76

20

28

6B

;

data want;

set have;

new = byte(input(hex,hex.));

run;

hex    new

4D      M

4F      O

76      v

20

28      (

6B      k

View solution in original post

3 REPLIES 3
Mike_Davis
Fluorite | Level 6

here is my ugly method:

please advise

I hope there is a function could be use directly.

Thanks

data table;
      do ascii=0 to 255;
            char=byte(ascii);
            put ascii= char=;
            hex=put(char,$HEX.);
   output;
      end;
run;
data have;
input hex $;
cards;
4D
4F
76
23
20
28
24
47
6B
52
;
run;

proc sql noprint;
create table want as
select a.*,b.char
from have as a
left join table as b
on a.hex=b.hex
;
quit;

MikeZdeb
Rhodochrosite | Level 12

hi ...

data have;

input hex $;

cards;

4D

4F

76

20

28

6B

;

data want;

set have;

new = byte(input(hex,hex.));

run;

hex    new

4D      M

4F      O

76      v

20

28      (

6B      k

Mike_Davis
Fluorite | Level 6

Thanks a lot Mike

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 14861 views
  • 3 likes
  • 2 in conversation