Date: Thu, 14 May 2009 06:14:23 -0700
Reply-To: Kevin Y <kevin77711@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Kevin Y <kevin77711@YAHOO.COM>
Subject: Re: Infile trouble
In-Reply-To: <ce1fb7450905140553r7221242ar4485e6cd38706339@mail.gmail.com>
Content-Type: text/plain; charset=iso-8859-1
Not working. The "YES" disappeard on the second observation.
data all;
format var1 $40. var2 $3.;
infile hosp truncover firstobs=2 dlm=z;
input var1 :$40. var2 :$3.;
run;
Obs VAR1 VAR2
1 ATENOLOL YES
2 BLOPRESS PLU
________________________________
From: "Data _null_;" <iebupdte@gmail.com>
To: Kevin Y <kevin77711@yahoo.com>
Cc: SAS-L@listserv.uga.edu
Sent: Thursday, May 14, 2009 8:53:02 PM
Subject: Re: Infile trouble
input var1 :$40. var2 :$3..;
See what happens if you add the COLON modifer to your INPUT statement.
Example above.
On 5/14/09, Kevin Y <kevin77711@yahoo.com> wrote:
> Thanks, Data _null_.
>
> The "^M"s were successfully removed by TERMSTR =CRLF.
>
> But I still could not merge the file with another file by var1 (with same length and same format). Like Gerhard pointed out that there may be other chars and I can not see.
>
>
>
>
> ________________________________
> From: "Data _null_;" <iebupdte@gmail.com>
> To: Kevin Y <kevin77711@yahoo.com>
> Cc: SAS-L@listserv.uga.edu
> Sent: Thursday, May 14, 2009 7:48:21 PM
> Subject: Re: Infile trouble
>
> Did the file come from Windows and your program is on UNIX?
>
> Try the INFILE statement option TERMSTR =CRLF;
>
> On 5/14/09, Kevin Y <kevin77711@yahoo.com> wrote:
> > All;
> >
> > I have trouble to read in a txt file(below).
> >
> > data all;
> > format var1 $40. var2 $3.;
> > infile hosp truncover firstobs=2 dlm=z;
> > input var1 $40. var2 $3.;
> > run;
> >
> > proc print;run;
> >
> > Obs VAR1 VAR2
> > 1 ATENOLOL YES ^M
> > 2 BLOPRESS PLUS YES ^M
> >
> > Var1=drug used by a patient, Var2=used or not.
> > 1. How can I efficiently remove the "^M"?
> > 2. After I removed the "^M" (not efficient at all), I could not merge the file with another file by var1 (with same length and same format). There may be something behind the screen.
> > Thanks.
> >
> >
> >
> >
>
>
>
>
>
|