From: francogrex on
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?

From: PeterC on
On Jul 23, 2:40 pm, francogrex <fra...(a)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_ = 1 to dim(strings) ;
strings(_n_) = 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
 | 
Pages: 1
Prev: Table of Contents PDF
Next: Which model to use?