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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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