SUPPORT / SAMPLES & SAS NOTES
 

Support

Sample 40700: Convert all character variables to numeric and use the same variable names in the output data set

DetailsCodeAboutRate It

This sample shows how to convert all character variables to numeric while excluding one character variable and keeping the same variable names in the output data set.

In general, a list of all the character variables will be used to create three macro variables.  One contains the list of character variable names, the second contains the list of new numeric variable names, and the third contains the list of new numeric variables names set equal to the list of character variable names for the RENAME statement. The SQL procedure is used to create the macro variables and the DATA step is used to convert the values from character to numeric.

Click the Full Code tab to view the sample program and further details about the process.




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.