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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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