<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Getting line break on some of the obs when writing to txt file in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949830#M42679</link>
    <description>&lt;P&gt;I am trying to convert sas dataset(containg nearly 9 Mil records) to text file using below code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In sas dataset also line is breaking&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data workdir.CCDUPSF(keep = PCEKEY SORTKEY FILL);&amp;nbsp;&lt;BR /&gt;Set workdir.CCORX01WTEMP;&lt;BR /&gt;LENGTH SORTKEY $42 FILL $2289;&lt;BR /&gt;SORTKEY= COMPBL(PCEKEY || FILL2);&lt;BR /&gt;FILL = COMPBL(FILL1 || FILL2 || FILL3);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET workdir.CCDUPSF;&lt;BR /&gt;FILE '$CURRPATH/YGRT010.txt';&lt;BR /&gt;PUT @0001 PCEKEY $40.&lt;BR /&gt;PUT @0041 FILL $2289.;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But while writing it to text file&amp;nbsp; , getting line break on some of the obs.&lt;/P&gt;
&lt;P&gt;can anyone suggest to fix this line break.&lt;/P&gt;
&lt;P&gt;This is hapenning for some obs not all the obs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Nov 2024 12:19:47 GMT</pubDate>
    <dc:creator>animesh123</dc:creator>
    <dc:date>2024-11-04T12:19:47Z</dc:date>
    <item>
      <title>Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949830#M42679</link>
      <description>&lt;P&gt;I am trying to convert sas dataset(containg nearly 9 Mil records) to text file using below code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In sas dataset also line is breaking&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data workdir.CCDUPSF(keep = PCEKEY SORTKEY FILL);&amp;nbsp;&lt;BR /&gt;Set workdir.CCORX01WTEMP;&lt;BR /&gt;LENGTH SORTKEY $42 FILL $2289;&lt;BR /&gt;SORTKEY= COMPBL(PCEKEY || FILL2);&lt;BR /&gt;FILL = COMPBL(FILL1 || FILL2 || FILL3);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA _NULL_;&lt;BR /&gt;SET workdir.CCDUPSF;&lt;BR /&gt;FILE '$CURRPATH/YGRT010.txt';&lt;BR /&gt;PUT @0001 PCEKEY $40.&lt;BR /&gt;PUT @0041 FILL $2289.;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But while writing it to text file&amp;nbsp; , getting line break on some of the obs.&lt;/P&gt;
&lt;P&gt;can anyone suggest to fix this line break.&lt;/P&gt;
&lt;P&gt;This is hapenning for some obs not all the obs&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 12:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949830#M42679</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-04T12:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949832#M42680</link>
      <description>&lt;P&gt;getting output data like this for FILL&lt;/P&gt;
&lt;P&gt;business, on bureau since '17.&amp;nbsp; (Line brk)&lt;BR /&gt;limited clean credit, a1 fcc hist.&amp;nbsp;(Line brk)&lt;BR /&gt;replacing unit. DBA: ROSE HILL (Line brk)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 12:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949832#M42680</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-04T12:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949833#M42681</link>
      <description>&lt;P&gt;It means you have carriage return (hex 0D) and/or linefeed (hex 0A) characters in your strings. Also add a LRECL=2400 option to your FILE statement.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 12:38:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949833#M42681</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-04T12:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949836#M42682</link>
      <description>&lt;P&gt;yes , I also try to add LRECL=2600 but still the line is breaking&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 13:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949836#M42682</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-04T13:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949837#M42683</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Can we add something here to fix this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Data workdir.CCDUPSF(keep = PCEKEY SORTKEY FILL);&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set workdir.CCORX01WTEMP;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LENGTH SORTKEY $42 FILL $2289;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SORTKEY= COMPBL(PCEKEY || FILL2);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FILL = COMPBL(FILL1 || FILL2 || FILL3);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 13:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949837#M42683</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-04T13:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949856#M42684</link>
      <description>&lt;P&gt;You are missing a semicolon to end your first PUT statement.&amp;nbsp; Either add the missing semicolon or remove the extra PUT keyword so that you write both variables with the same PUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that is probably not your real problem.&amp;nbsp; Most likely the text you are writing with the PUT statements contain the ASCII codes that mark the end of a line.&amp;nbsp; LF on Unix or CRLF on Windows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at the text file with something that allows you to see the characters it contains. Notepad+ I think allows this.&amp;nbsp; Or just use a SAS data step with the LIST statement.&amp;nbsp; Read the file as fixed length records instead of "lines".&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile '$CURRPATH/YGRT010.txt' lrec=100 recfm=f ;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or display the values of you character variable using the $HEX format to see the ASCII codes for the values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Once you see what characters are there, look for '0A'x which is a Line Feed or '0D'x which is a Carriage Return, then modify our code to REMOVE or REPLACE those characters.&lt;/P&gt;
&lt;P&gt;For example by translating them into space characters instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
  SET workdir.CCDUPSF;
  fill = translate(fill,'  ','0A0D'x);
  FILE '$CURRPATH/YGRT010.txt';
  PUT @0001 PCEKEY $40. ;
  PUT @0041 FILL $2289.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 16:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949856#M42684</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-04T16:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949858#M42685</link>
      <description>&lt;P&gt;Your use of&amp;nbsp;@ pointer controls and fixed length formats makes it look like perhaps you want to create a file with FIXED LENGTH records (essentially a binary file even if all of the bytes are valid ASCII characters) instead of a text file with variable length LINES of text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is the case then whether or not the text being written has embedded end of line characters should not matter (as long as you read it as fixed length records (binary file) as well).&amp;nbsp; Since 40 + 2289 is 2329 looks like you want a record length of 2329.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA _NULL_;
  SET workdir.CCDUPSF;
  FILE '$CURRPATH/YGRT010.txt' recfm=f lrecl=2329 ;
  PUT PCEKEY $40. FILL $2289.;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 04 Nov 2024 17:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949858#M42685</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-04T17:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949863#M42686</link>
      <description>&lt;P&gt;As long as you have CR/LF characters in your strings, the behavior will not change.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 18:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949863#M42686</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-04T18:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949903#M42687</link>
      <description>yep I tried with this code ,still the same output even try to add strip and Compbl to remove any blank</description>
      <pubDate>Tue, 05 Nov 2024 10:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949903#M42687</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-05T10:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949904#M42688</link>
      <description>Example:-&lt;BR /&gt;with standard rate. Added room for &lt;BR /&gt;backend. Trading open auto. Well &lt;BR /&gt;pd autos and mtg. Additional &lt;BR /&gt;household income evident. Please ,&lt;BR /&gt;&lt;BR /&gt;Even tried to do the same with proc export ,but result is same&lt;BR /&gt;</description>
      <pubDate>Tue, 05 Nov 2024 10:40:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949904#M42688</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-05T10:40:41Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949905#M42689</link>
      <description>&lt;P&gt;&lt;STRONG&gt;We are&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;talking about&amp;nbsp;&lt;U&gt;blanks&lt;/U&gt;, we are talking about the special line-breaking characters!!!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Use the $HEX format to display your strings so you can exactly determine which characters cause the line break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 10:48:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949905#M42689</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-05T10:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949912#M42690</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Example:-&lt;BR /&gt;with standard rate. Added room for &lt;BR /&gt;backend. Trading open auto. Well &lt;BR /&gt;pd autos and mtg. Additional &lt;BR /&gt;household income evident. Please ,&lt;BR /&gt;&lt;BR /&gt;Even tried to do the same with proc export ,but result is same&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Let' first recreate your example as a text string with embedded end of line characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  example ='with standard rate. Added room for' || '0D0A'x
        || 'backend. Trading open auto. Well' || '0D0A'x
        || 'pd autos and mtg. Additional' || '0D0A'x
        || 'household income evident. Please ,' 
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now we can try writing it to a text file.&lt;/P&gt;
&lt;PRE&gt;36   filename text temp;
37   data _null_;
38     set have;
39     file text ;
40     put example;
41   run;

NOTE: The file TEXT is:
      Filename=C:\Users\...\#LN00010,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=05Nov2024:07:34:19,
      Create Time=05Nov2024:07:34:19

NOTE: 1 record was written to the file TEXT.
      The minimum record length was 134.
      The maximum record length was 134.
NOTE: There were 1 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;So one line was written.&amp;nbsp; But because the content included the end of line characters when you read it back in as a simple text file there are instead four lines read.&lt;/P&gt;
&lt;PRE&gt;43   data _null_;
44     infile text;
45     input;
46     list ;
47   run;

NOTE: The infile TEXT is:
      Filename=C:\Users\...\#LN00010,
      RECFM=V,LRECL=32767,File Size (bytes)=136,
      Last Modified=05Nov2024:07:34:19,
      Create Time=05Nov2024:07:34:19

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         with standard rate. Added room for 34
2         backend. Trading open auto. Well 32
3         pd autos and mtg. Additional 28
4         household income evident. Please , 34
NOTE: 4 records were read from the infile TEXT.
      The minimum record length was 28.
      The maximum record length was 34.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;But if we read it as binary (fixed length) records we can see the actual end of line characters (and their actual hexcodes).&amp;nbsp; For example notice that there is OD and OA characters in the 35 and 36th byte of the file.&lt;/P&gt;
&lt;PRE&gt;49   data _null_;
50     infile text recfm=f lrecl=100;
51     input;
52     list;
53   run;

NOTE: The infile TEXT is:
      Filename=C:\Users\...\#LN00010,
      RECFM=F,LRECL=100,File Size (bytes)=136,
      Last Modified=05Nov2024:07:34:19,
      Create Time=05Nov2024:07:34:19

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0

1   CHAR  with standard rate. Added room for..backend. Trading open auto. Well..pd autos and mtg. Additional..
    ZONE  7676277666676276762246666276662667006666666225766666267662677622566600762677672666267622466676666600
    NUMR  79480341E412402145E01445402FFD06F2DA213B5E4E042149E70F05E0154FE075CCDA040154F301E40D47E0144949FE1CDA

2   CHAR  household income evident. Please ,.. 36
    ZONE  667766666266666626766667225666762200
    NUMR  8F5358FC409E3FD5056945E4E00C51350CDA
NOTE: 2 records were read from the infile TEXT.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;
&lt;P&gt;But if we replace those characters with spaces.&lt;/P&gt;
&lt;PRE&gt;54   filename text temp;
55   data _null_;
56     set have;
57     file text ;
58     example=translate(example,'  ','0D0A'x);
59     put example;
60   run;

NOTE: The file TEXT is:
      Filename=C:\Users\...\#LN00011,
      RECFM=V,LRECL=32767,File Size (bytes)=0,
      Last Modified=05Nov2024:07:40:27,
      Create Time=05Nov2024:07:40:27

NOTE: 1 record was written to the file TEXT.
      The minimum record length was 134.
      The maximum record length was 134.
NOTE: There were 1 observations read from the data set WORK.HAVE.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


61
62   data _null_;
63     infile text;
64     input;
65     list ;
66   run;

NOTE: The infile TEXT is:
      Filename=C:\Users\...\#LN00011,
      RECFM=V,LRECL=32767,File Size (bytes)=136,
      Last Modified=05Nov2024:07:40:27,
      Create Time=05Nov2024:07:40:27

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         with standard rate. Added room for  backend. Trading open auto. Well  pd autos and mtg. Additional
     101  household income evident. Please , 134
NOTE: 1 record was read from the infile TEXT.
      The minimum record length was 134.
      The maximum record length was 134.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;Now there is only one line in the text file.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 12:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949912#M42690</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-05T12:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949922#M42691</link>
      <description>&lt;P&gt;So this is for infile ,am not reading the file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to write the data using this code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DATA _NULL_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET workdir.CCDUPSF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FILE '$CURRPATH/YGRT010.txt';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PUT @0001 PCEKEY $40.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PUT @0041 FILL $2289.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 15:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949922#M42691</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-05T15:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949937#M42692</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/430763"&gt;@animesh123&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;So this is for infile ,am not reading the file&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to write the data using this code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DATA _NULL_;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SET workdir.CCDUPSF;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FILE '$CURRPATH/YGRT010.txt';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PUT @0001 PCEKEY $40.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PUT @0041 FILL $2289.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We do not seem to be communicating. The example I showed had one data step to create some example data so that everyone can work from the same source.&amp;nbsp; Then a step to write that to a file, like your step.&amp;nbsp; Then other steps to check the resulting contents of the file that was just written.&amp;nbsp;Please read the example code I posted and apply it to your situation.&amp;nbsp; You need to REMOVE the LINE FEED ('0A'x) and CARRAIGE RETURN ('0d'x) characters from the data before running the PUT statement.&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also the error in your data step is still there.&amp;nbsp; You have one PUT statement that spans two lines of code.&amp;nbsp; It is writing three variables, one of which is named PUT.&amp;nbsp; But I do not think that is what is causing your extra lines (unless you actually have a variable named PUT that contains linefeed or carriage return characters).&lt;/P&gt;
&lt;P&gt;You could use one PUT statement to write both fields on the same line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set workdir.ccdupsf;
  file "$currpath/ygrt010.txt";
  put @0001 pcekey $40. @0041 fill $2289.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to use two PUT statements&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set workdir.ccdupsf;
  file "$currpath/ygrt010.txt";
  put @0001 pcekey $40.;
  put @0041 fill $2289.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You will write TWO lines for every observation in your dataset.&amp;nbsp; If you want to use two PUT statements and write one line instead then add a trailing&amp;nbsp;@ to the first one to prevent the line from being ended too early.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set workdir.ccdupsf;
  file "$currpath/ygrt010.txt";
  put @0001 pcekey $40. @ ;
  put @0041 fill $2289.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Nov 2024 16:21:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/949937#M42692</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-05T16:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/950102#M42705</link>
      <description>&lt;P&gt;For this I did some more investigation to find out variable which causing issue&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I found like 2 or 3 variable which have this issue&amp;nbsp; pasting one as an e.g&lt;/P&gt;
&lt;P&gt;DECIS_CMT_TX&lt;BR /&gt;vm for Karina, will need cash added &lt;BR /&gt;to offering. see condition. future &lt;BR /&gt;offerings may require a line of &lt;BR /&gt;credit.&lt;/P&gt;
&lt;P&gt;I am getting this data from database itself like above pasted ,&lt;/P&gt;
&lt;P&gt;As I am trying to write the same into text file the format is coming same as we fetched from database&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there anyway to fix this on variable&amp;nbsp; itself?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2024 09:41:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/950102#M42705</guid>
      <dc:creator>animesh123</dc:creator>
      <dc:date>2024-11-07T09:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting line break on some of the obs when writing to txt file</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/950103#M42706</link>
      <description>&lt;P&gt;You have been told&amp;nbsp;&lt;U&gt;repeatedly&lt;/U&gt; what to do:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;find the characters causing the line breaks&lt;/LI&gt;
&lt;LI&gt;get rid of them by using TRANSLATE() to replace them with blanks&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 07 Nov 2024 10:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Getting-line-break-on-some-of-the-obs-when-writing-to-txt-file/m-p/950103#M42706</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-07T10:47:59Z</dc:date>
    </item>
  </channel>
</rss>

