As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Talk:Numeric transformations

From sasCommunity
Jump to: navigation, search

Question: Is anyone aware of transformation code that has been shared on sasCommunity.org that does the following?

In the modeling process, between the dependent and independent variables; it's often useful to search for transformations that result in stronger/more linear relationships. Has anyone seen code that takes a set of independent variables, runs each of them through several transformations (e.g., square, log, etc.), then "picks" the stongest transformation for that independent variable, relative to the dependent rariable? Any ideas are appreciated.


Great page. Not sure if it fits/applies to this page, so I thought I would ask on the discussion page if it does:


If you need to check for missing numerics, in addition to using the MISSING function, you can also say:

   if x le ._z then . . . . . . 

There are 28 SAS missing values which are represented in SAS as:

  • .
  • ._
  • .a
  • . . . . thru . . . .
  • .z

Since .z is evaluated as largest SAS missing value, checking that a value is less than or equal to .z catches them all.


--Donh 22:30, 4 February 2009 (EST)

There are variations and alternatives for many (most?) of the expressions presented. The second paragraph on missing value fundamentals seems like a tangent here. For now, I parked it in the heading of Category:Missing Values.--Howles 22:57, 4 February 2009 (EST)

Good idea to make a category for this and put this on the category page. --Donh 23:02, 4 February 2009 (EST)


Added this page as the read more links for Tips:Convert MISSING to 0. --Don Henderson 10:36, 14 March 2009 (EDT)

COALESCE instead of SUM

Using the SUM function in

sum(x,0)

does only trivial summing. The function is used for the desired side effect. In contrast,

coalesce(x,0)

is a more "surgical" choice to replace a missing value with zero.--Howles 21:20, 1 September 2009 (UTC)

Data step only

This page should says that these numeric transformations work (or are tested) in the data step only. We have other expressions like where expression, macro expression, and others that may behave differently. For instance, "not ." or "not (blank)" in macro expression are an error; not 1, nor true. -- chang_y_chung 17:12, 24 January 2011 (UTC)

  • I put in a link to the documentation of SAS Expressions, which appears under System (not DATA Step) Concepts. I think they all should work in SQL and in WHERE conditions, probably even in macro code if contained in appropriate %SYSFUNC, %EVAL(), etc.--Howles 22:02, 27 January 2011 (UTC)