Tags

, , , ,

Changes must be in a data-step.

If you are recoding an existing variable, you may need to come back in and rename the new variable (NUMERIC_var) back to the original (CHAR_var) name so as to be consistent with your variable dictionary.

The Input function in SAS will take the form: “Input (variable, format).” Specify the numeric format that you want to create, but for dates this will also depend on the character contents. If you are capturing dates, then “2014-01” is a different than “01-20-2014.”


EXAMPLE

DATA mydataset_NEW;

SET mydataset;

NUMERIC_var = Input ( CHAR_var, 3.0);  /* for simple conversion */

DATE_var = Input ( CHAR_var, date9.); /* for dates */

.

.

.

RUN;