How to convert numbers in a character variable to Numeric in sas -


can me resolve this?

i have large raw dataset character variable contains text strings along numbers & dates defined in character format. want process dataset , create new numeric variable , populate values when text in actual variable either number or date value. otherwise missing

rawdata:

actual_variable                              new_num_variable(expected values) ------------------                           --------------------------------- oded on pills threw them - 2006 y 1                                                        1 5                                                        5 oded on pills 6                                                        6 less once week n n 2006-11-12                                               2006-11-12 

many in advance

the easy way (if know specific date format) use input function. 09:27 if put(input(var,??yymmdd10.),yymmdd10.)=var date!

else if input(var,best.) ne . number.  otherwiseits character string. 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -