Sample 24617: Determine the log of a variable in any base
Compute the log of a variable in any base using the LOG
function and the property:
logB(X)=log(X) / log10(B)
Note:
X is the variable whose log will be determined.
B is the base of the log that will be determined.
Y is the log, base b, of x.
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.
data test;
b=6;
do i=1 to 10;
x=int(ranuni(12345)*100);
/* Y equals the LOG, base B, of X*/
y=LOG10(x)/LOG10(b);
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.
Obs b i x y
1 6 1 36 2.00000
2 6 2 74 2.40214
3 6 3 83 2.46620
4 6 4 27 1.83944
5 6 5 18 1.61315
6 6 6 72 2.38685
7 6 7 7 1.08603
8 6 8 73 2.39455
9 6 9 70 2.37113
10 6 10 76 2.41703
Compute the log of a variable in any base using the LOG
function and the property:
logB(X)=log(X) log10(B)
| Type: | Sample |
| Topic: | SAS Reference ==> DATA Step SAS Reference ==> Functions ==> Mathematical
|
| Date Modified: | 2005-12-16 03:02:54 |
| Date Created: | 2004-09-30 14:08:58 |
Operating System and Release Information
| SAS System | Base SAS | All | n/a | n/a |