BookmarkSubscribeRSS Feed
srikanthyadav44
Quartz | Level 8

dear all 

i have 40 different variables in my dataset. 

some of the variables are in character form and some are numeric. 

I have to convert all tthe variables into numeric form. 

how to do it in SAS.

 

thanks in advance. 

 

3 REPLIES 3
srikanthyadav44
Quartz | Level 8

dear 

i tried the following code from the link suggested by you. 

But it is not working.

data test2;                                               
   set test;                                                 
   array ch(*) $ &c_list;                                    
   array nu(*) &n_list;                                      
   do i = 1 to dim(ch);                                      
      nu(i)=input(ch(i),8.);                                  
   end;                                                      
   drop i &c_list;                                           
   rename &renam_list;                                                                                      
run;   

there are some other codes also. but i could not understand them. 

i am attaching the error displayed by SAS

please help me solving the problem

thanks in advance

 

Kurt_Bremser
Super User

Ideally, you do that when you import the data into SAS by making sure that the values are read correctly.

 

How did you receive the data, and how did you import it?

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 993 views
  • 0 likes
  • 3 in conversation