remove newlines from dataset

  • Follow


Hi, I have a dataset with some cells that have 
erroneously entered "newline" or "return" characters 
in them and I would like to export the dataset into 
tab delimited excel, but those that have newlines pose 
a problem. Is there a way to clean them up in the sas 
dataset (of course without removing the true newlines 
at then end of each row) before exporting?

0
Reply francogrex 7/23/2010 1:40:09 PM

On Jul 23, 2:40=A0pm, francogrex <fra...@grex.org> wrote:
> Hi, I have a dataset with some cells that have
> erroneously entered "newline" or "return" characters
> in them and I would like to export the dataset into
> tab delimited excel, but those that have newlines pose
> a problem. Is there a way to clean them up in the sas
> dataset (of course without removing the true newlines
> at then end of each row) before exporting?

data fixed ;
   set troubled ;
   array strings(*) _character_ ;
   do _n_ =3D 1 to dim(strings) ;
      strings(_n_) =3D translate( strings(_N_), '#!','0D0A'x ) ;
   end ;
run ;
replaces CR with a # and LF with !
accross all strings in your sas dataset, writing to table work.fixed

if you want some other replacements, then replace preferred characters
instead of #!

luck
peterC
0
Reply PeterC 7/23/2010 1:48:57 PM


1 Replies
411 Views

(page loaded in 0.602 seconds)

Similiar Articles:













7/29/2012 10:19:09 AM


Reply: