BookmarkSubscribeRSS Feed
Defense
Obsidian | Level 7


My_table has two fields, one is defined as [c_array] char(20), with values like ‘123456781ABCD234’. Another field is defined as [b_array] binary(8). The task is to convert value of c_array into binary and assign it to b_array.

 

thanks

 

3 REPLIES 3
PGStats
Opal | Level 21

Beware of truncation. 20 hexadecimal numbers will require at least 80 bits of binary storage.

PG
Haikuo
Onyx | Level 15

 Are you doing a hex to binary conversion like @PGStats suggested, or a char to binary conversion? If hex-binary, given the length is 20, you may need to read it in as hex one digit at a time, and spit it out as binary, then concatenate them together to the length of 80.  If char-binary, there is a format $binaryw. you may need to use.

 

Take a look at format/informat $binaryw and binaryw.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 5775 views
  • 0 likes
  • 4 in conversation