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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Need to read the binary's from a numeric JMP varia...

- 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
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 22, 2012 7:21 AM
(876 views)

I have a need to read the imbedded binary values in a numeric field. I developed the following script that appears to work, but it is not as nice as I hoped it could be.

x = **19**;

thehex = Hex**(** x **)**;

binary = Associative Array**(**

**{{**"0", "0000"**}**, **{**"1", "0001"**}**, **{**"2", "0010"**}**, **{**"3", "0011"**}**, **{**"4", "0100"**}**,

**{**"5", "0101"**}**, **{**"6", "0110"**}**, **{**"7", "0111"**}**, **{**"8", "1000"**}**, **{**"9", "1001"**}**,

**{**"A", "1010"**}**, **{**"B", "1011"**}**, **{**"C", "1100"**}**, **{**"D", "1101"**}**, **{**"E", "1110"**}**,

**{**"F", "1111"**}}**

**)**;

TheBinary = "";

For**(** i = **1**, i <= **4**, i++,

thebinary = thebinary || binary**[**Uppercase**(** Substr**(** thehex, i, **1** **)** **)]**

**)**;

Is there an easier way?

Jim

3 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 22, 2012 7:43 AM
(718 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 22, 2012 8:03 AM
(718 views)

Thanks for the pointer, but it does not give me what I need. What I am looking for is code that will return the 0/1 string representative of an integer value in JMP.

Jim

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jun 22, 2012 8:20 AM
(718 views)

By 0/1 string I assume you mean base 2 conversion? That function does it. for example here's 19 converted to base 2:

print(base(19, 2))

In the log window:

"10011"