Sample 43523: How to convert values created with the LOG2 function back to their original value
There may be times when you have a value that was created using the SAS function LOG2 that you would like to return to its original value.
The sample below will do that. Also, it does not matter if the value was created using the SAS function, the same conversion formula applies.
The results of running the sample below can be viewed by clicking on the Results tab above.
data one;
do i = 1 to 32;
L2=log2(i);
original=2**(L2);
output;
end;
run;
proc print;
run;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
The SAS System 10:30 Tuesday, June 14, 2011 55
Obs i L2 original
1 1 0.00000 1
2 2 1.00000 2
3 3 1.58496 3
4 4 2.00000 4
5 5 2.32193 5
6 6 2.58496 6
7 7 2.80735 7
8 8 3.00000 8
9 9 3.16993 9
10 10 3.32193 10
11 11 3.45943 11
12 12 3.58496 12
13 13 3.70044 13
14 14 3.80735 14
15 15 3.90689 15
16 16 4.00000 16
17 17 4.08746 17
18 18 4.16993 18
19 19 4.24793 19
20 20 4.32193 20
21 21 4.39232 21
22 22 4.45943 22
23 23 4.52356 23
24 24 4.58496 24
25 25 4.64386 25
26 26 4.70044 26
27 27 4.75489 27
28 28 4.80735 28
29 29 4.85798 29
30 30 4.90689 30
31 31 4.95420 31
32 32 5.00000 32
| Type: | Sample |
| Topic: | SAS Reference ==> Functions ==> Mathematical ==> LOG2 SAS Reference ==> DATA Step
|
| Date Modified: | 2011-06-14 14:06:01 |
| Date Created: | 2011-06-14 13:37:36 |
Operating System and Release Information
| SAS System | Base SAS | z/OS | | |
| Z64 | | |
| OpenVMS VAX | | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| OS/2 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2003 for x64 | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows Server 2008 for x64 | | |
| Microsoft Windows XP Professional | | |
| Windows 7 Enterprise 32 bit | | |
| Windows 7 Enterprise x64 | | |
| Windows 7 Home Premium 32 bit | | |
| Windows 7 Home Premium x64 | | |
| Windows 7 Professional 32 bit | | |
| Windows 7 Professional x64 | | |
| Windows 7 Ultimate 32 bit | | |
| Windows 7 Ultimate x64 | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| Windows Vista for x64 | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| ABI+ for Intel Architecture | | |
| AIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| IRIX | | |
| Linux | | |
| Linux for x64 | | |
| Linux on Itanium | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Solaris | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |