sas - How to use tranwrd in a data step? -


i try substitute y x
tried used tranwrd function in data step . result 1 row

data test2 ;  set test  ; address =  tranwrd(address , 'y' , 'x' ) ;    put address ; run;  

test data follows

    id  address     1   123 y street     2   234 y street     3   345 street 

the code, written, should work. removing put line prevent each line being written log (this speed things if have large data set):

data test2 ;  set test  ; address =  tranwrd(address , 'y' , 'x' ) ;    run;  

the address = tranwrd(address , 'y' , 'x' ) ; adequately defines variable value.

the put statement writes value of address sas log @ point in data step.

you can read more put statement here : http://www2.sas.com/proceedings/sugi27/p104-27.pdf


Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -