turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to convert character value to binary value an...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 09:50 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 09:59 PM

I found a similar thread in sas commnities, hope this answers your query

Thanks,

Jag

Jag

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 10:56 PM

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

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

09-01-2016 10:06 AM

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.