sas >> how to change the variable type?

by » Mon, 09 Jul 2007 19:11:42 GMT

it is need that character type is changed to numeric type. plz how to
make it ? thank.

sas >> how to change the variable type?

by diddy1512 » Mon, 09 Jul 2007 19:59:27 GMT


use the INPUT function

new_var=input(old_var, informat.) where informat is the SAS informat that you want to apply to the source.

Best regards,


it is need that character type is changed to numeric type. plz how to
make it ? thank.

Got a little couch potato?
Check out fun summer activities for kids.

sas >> how to change the variable type?

by nichas » Mon, 09 Jul 2007 20:19:59 GMT

say .. for example:
char_var is a character variable
I create another variable num_var from char_var
Use the input() function
num_var = input(char_var, informat);

the informat will depend on what is being stored in the char_var

data one;
char_var = '12sep2006';
num_var = input(char_var,date9.);

num_var will have the date value. You need to apply date* format to
get the num_var in visible date format.

how to change the variable type?

by Barry Schwarz » Tue, 10 Jul 2007 10:56:44 GMT

On Mon, 09 Jul 2007 04:11:42 -0700, " XXXX@XXXXX.COM "

You cannot change the type of a variable.

You can use the input function to convert the value the character
variable represents and assign that converted value to a numeric

Remove del for email

how to change the variable type?

by G.Q.LEE. » Tue, 10 Jul 2007 14:58:37 GMT

grateful to your help.

how to change the variable type?

by G.Q.LEE. » Tue, 10 Jul 2007 14:59:21 GMT

grateful to you for your help.

Similar Threads

1. how to change the type of existing variable?

2. Change SAS Variable type from Numeric to Character

I am trying to use the Put function to change a numeric variable to a
character variable.

It seems I am having trouble with the format for the original field
because the text field it creates is either centered or has varying
amounts of space to the right.

my code is this:

data two;
   set one;

The properties for the original field are format 9. and informat 11.

Any help is much appreciated.

3. Using Sql Views to Rename, Order and Change Variable Type

4. Change TYPE to char for all vars?



Does anyone know the fastest way to set the type of all variables to




Igor Kurbeko

Clinical Programmer Analyst

678 336 4328



Imagination is more important than knowledge


5. How to change data type/length in a SAS dataset

6. change a column's data type ?

I want to change a variable from numeric to character.
proc datasets + modify + format can not work. also we can not use
proc sql + alter table to do this.

It seems that the only way for me is to use data step + put function to
generate a new variable of charater type, drop the old one, then rename
the new one.

I want to know if there is a way to directly 'CAST' num to char or vice

Thanks a lot.

7. reading xls without proc import or changing file type

8. Change variables to variable names

Hi all,

I have an arry which has 90 values in it, the values are something like
ID, Name, Gender, PhoneNumber.........

What I want to do is to use these values as variable names/column names
when I create new dataset. This new dataset should be something like
the following:

ID      Name       Gender    PhoneNumber ..........
 x          y                z                   a

There should be some easy ways to do it than hardcoding, but I just
can't figure it out myself. Please help.

Thanks a lot.