Date: Wed, 3 Aug 2005 16:57:29 -0400
Reply-To: "Fehd, Ronald J" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J" <rjf2@CDC.GOV>
Subject: Re: please help convert text notes to SAS
Content-Type: text/plain; charset="us-ascii"
> From: Nancy Li
>
> I have a text file with multiple lines, I would like to
> convert this text file to SAS and make these multiple lines
> notes into one variable. I used the following code, but it
> doesn't work as what I expected. Can anybody help me with
> this? Thanks!
>
> data _null_;
> length value $2000;
> infile 'C:\test.txt' dsd missover lrecl=1500;
you need to match lrecl with pad:
lrecl = 1500 pad
> input;
I see another responder suggesting
input $;
how about
input Value $1500;*your lrecl value;
> retain value;
> value = trim(left(value || _infile_));
uh, how long is this text?
1500 or 2000?
you probably meant:
value = trim(left(value)) || _infile_;
> put value;
hmmmm,
if you are going to accumulate the text
you will need two values:
retain AllText '.';
input Text ...;
AllText = trim(AllText)
!! trim(left(Text));
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov