Date: Fri, 10 May 2002 08:54:28 +0200
Reply-To: Andreas Grüninger <andreas.grueninger@LFL.BWL.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Andreas Grüninger <andreas.grueninger@LFL.BWL.DE>
Organization: InterNetNews at News.BelWue.DE (Stuttgart, Germany)
Subject: Re: Put and carraige-returns
Use the VARYINGx. format for output too.
e.g.
* do some manipulation with your variable line and ask afterwards for the
length of line ;
...
ln = LENGTH( line );
PUT line VARYING1024. ln;
...
"Goldman, Brad AT-Atlanta" <Brad.Goldman@AUTOTRADER.COM> schrieb im
Newsbeitrag
news:2AE36192DC1E24479B195A804DE811B53D676C@at0exc00.autoconnect...
> Hi all. I am working on a program which will update some HTML forms via
> SAS. Here is a stripped down version of the code:
> _____________
> data _null_;
> infile "/links/mandash/dealer_services/wartest.htm" length=ln;
> file "~/temp";
> input @;
> input line $varying1024. ln;
> put line;
> if index(line,"DATEMARK") then do;
> if index(line,"WAR") then put "Harry Potter and the Funny Mushrooms";
> end;
> run;
> _______________
>
> 1) The input file is nicely indented and formatted. The output file is
all
> left-justified. I assume this is because $varying gets rid of leading
> blanks, but I think I need to use $varying for this kind of read in/put
out
> logic. Any ideas how to preserve leading spaces?
>
> 2) If the input file does not have "DATEMARK" and "WAR", the files comes
out
> as desired. That is exactly, like it came in (except for problem #1). If
> "DATEMARK" and "WAR" are there however, it not only inserts my random
text,
> but it also adds a "^M" (unix carriage-return character) to each line.
Any
> ideas why it does this, and how to make it stop?
>
> Thanks for any help,
> Brad
|