You have a good idea. The way I would describe what you want to do is: create a new character variable or new category variable based on the VALUE of a numeric variable. Technically, you are not assigning a numeric statement to a character variable or a character value to a numeric variable.
There are 2 ways to do what you want:
1) is to create your own format and then use either the PUT function or INPUT function to create either a character or numeric variable
2) use a series of IF statements to assign a value to either a character or numeric variable.
There are some rules about creating variables. For example:
newnumvar = 10; <-- numeric variable being created
newcharvar = 'Wombat'; <--character variable being created
** NUMERIC variable AGECAT being created;
if age gt 0 and age lt 4 then agecat = 1;
else agecat = 2;
** CHARACTER variable AGECAT2 being created;
if age gt 0 and age lt 4 then agecat2 = 'toddler ';
else agecat2 = 'pre-school';
Note that character variables are -usually- assigned quoted strings or assigned the values of other character variables. So when you had something like:
agegroup = toddler
SAS thought that toddler was a variable and you wanted to assign the value of the toddler variable to the new variable agegroup.
You might want to look in the documentation for the section about variables and how to create them and how to use them.