## How to replace binary Number to 9

Solved
Occasional Contributor
Posts: 6

# How to replace binary Number to 9

Hi

My data set values are

Numbers

1101

1001

0000

1000

0101

1010

And i want to replace the '0' with 3 and '1' with 2 .

How can we do that?

Accepted Solutions
Solution
‎02-18-2018 02:17 AM
Super User
Posts: 10,570

## Re: How to replace binary Number to 9

Convert to character with the put() function, use the translate() function to do the replacements, and convert back to numeric by using the input() function.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code

All Replies
Solution
‎02-18-2018 02:17 AM
Super User
Posts: 10,570

## Re: How to replace binary Number to 9

Convert to character with the put() function, use the translate() function to do the replacements, and convert back to numeric by using the input() function.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Occasional Contributor
Posts: 6

## Re: How to replace binary Number to 9

Thanks mate,

Yes Its working fine.

☑ This topic is solved.