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
- /
- Analytics
- /
- Stat Procs
- /
- Adding new variable

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

05-18-2017 01:38 AM

Hello

I am tring to add a new variable with the following code:

data new; set sasuser.hed1;

lncapax = ln(capaxass);

run;

The log I got is:

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.NEW may be incomplete. When this step was stopped there were 0

observations and 183 variables.

NOTE: At least one W.D format was too small for the number to be printed. The decimal may be shifted

by the "BEST" format.

I believe the reason is that there is observation with 0 value and the ln of it is an error. How can I fix it?

Thanks a lot!

Accepted Solutions

Solution

05-18-2017
02:47 AM

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

05-18-2017 02:36 AM - edited 05-18-2017 02:40 AM

Use the LOG function instead of LN when you want the natural logarithm.

And remember that the logarithm is defined only for values >0. You can not take the logarithm of zero or a negative number.

All Replies

Solution

05-18-2017
02:47 AM

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

05-18-2017 02:36 AM - edited 05-18-2017 02:40 AM

Use the LOG function instead of LN when you want the natural logarithm.

And remember that the logarithm is defined only for values >0. You can not take the logarithm of zero or a negative number.