<?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 Re: How to create a text file and show each obs in one row? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303518#M312412</link>
    <description>&lt;P&gt;You shouldn't put a | between them. &amp;nbsp;The line is terminated by a given line terminator - so long as the person importing the file knows the line terminator, they can read it in correctly. &amp;nbsp;See this article for the process:&lt;BR /&gt;&lt;A href="http://support.sas.com/kb/14/178.html" target="_blank"&gt;http://support.sas.com/kb/14/178.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for more information on this topic:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Newline" target="_blank"&gt;https://en.wikipedia.org/wiki/Newline&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Oct 2016 09:43:03 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-10-10T09:43:03Z</dc:date>
    <item>
      <title>How to create a text file and show each obs in one row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303146#M312409</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm working with a program to create a text file. It works fine but it doesn't go to the next line for the next obs and it continues with&lt;/P&gt;
&lt;P&gt;the same line.&amp;nbsp;How can I create a text file that in each row shows one record(obs)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code:&lt;/P&gt;
&lt;P&gt;data _null_ ;&amp;nbsp;&lt;BR /&gt; set table.abc; &lt;BR /&gt; FILE '/opt/sas94/home/user1/text1.txt' dsd dlm=',' ;&amp;nbsp;&lt;BR /&gt; PUT var1 var2 var3 var4 var5 var6 var7 var8; &lt;BR /&gt;run ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:09:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303146#M312409</guid>
      <dc:creator>Riana</dc:creator>
      <dc:date>2016-10-07T12:09:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file and show each obs in one row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303148#M312410</link>
      <description>&lt;P&gt;What are you opening the file in to view the data? &amp;nbsp;The reason is I run this on my SAS:&lt;/P&gt;
&lt;PRE&gt;data _null_; 
  set sashelp.class; 
  file 'c:\test.csv' dsd dlm=','; 
  put name sex age; 
run ;&lt;/PRE&gt;
&lt;P&gt;And it works fine when I open it in Notepad. &amp;nbsp;Do note the consistent code formatting, indetation and the use of code editor {i} above your post. &amp;nbsp;Note also that I call the output file .csv, this is because you are creating a Comma Separated Variable file, so make sure the file extension describes the data correctly.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;What I suspect is your opening that data in either A) a package that doesn't interpret line feed/break characters, or B) your moving it across to Windows from Unix - this is most likely and common. &amp;nbsp;Windows and Unix have different CR/LF special characters which indicate the end of line.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303148#M312410</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-07T12:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file and show each obs in one row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303517#M312411</link>
      <description>&lt;P&gt;Thank you RW9 for your reply.&lt;/P&gt;
&lt;P&gt;I'm opening the text file in Notepad. I've corrected my code by using pipe '|' as delimeter. This file should be sent as text file:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;data _null_ ;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;     set table.abc; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;     FILE '/opt/sas94/home/user1/text1.txt' dsd dlm='|' ;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;     PUT var1 var2 var3 var4 var5 var6 var7 var8; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run ;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;B) your moving it across to Windows from Unix - this is most likely and common.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Yes,maybe it is the issue. There are&amp;nbsp;two ways &amp;nbsp;for me to run the code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;SPAN&gt;Localy from my PC and connect to the server and save text file there.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;From Citrix (Windows server) and save file on server.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;SPAN&gt;In both cases I faced the same problem but it seems that it is OK&amp;nbsp;for my colleague to receive the file in this way. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But I have another question. Here is an example of text file:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;100000095|abcdefghijk|kj7764bbid|20JAN2015|21FEB2015|201501100000098|abcdefncvbjk|abcdehg564d5|09JAN2015|02APR2015|201501100000096&lt;/PRE&gt;
&lt;P&gt;In 201501100000098, 201501 is the last value for the first record and&amp;nbsp;&lt;SPAN&gt;100000098 is the first value for the second record.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;How should I change the code so '|' to be placed between&amp;nbsp;&lt;SPAN&gt;201501 and&lt;/SPAN&gt;&lt;SPAN&gt;100000098?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 09:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303517#M312411</guid>
      <dc:creator>Riana</dc:creator>
      <dc:date>2016-10-10T09:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a text file and show each obs in one row?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303518#M312412</link>
      <description>&lt;P&gt;You shouldn't put a | between them. &amp;nbsp;The line is terminated by a given line terminator - so long as the person importing the file knows the line terminator, they can read it in correctly. &amp;nbsp;See this article for the process:&lt;BR /&gt;&lt;A href="http://support.sas.com/kb/14/178.html" target="_blank"&gt;http://support.sas.com/kb/14/178.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And for more information on this topic:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Newline" target="_blank"&gt;https://en.wikipedia.org/wiki/Newline&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2016 09:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-create-a-text-file-and-show-each-obs-in-one-row/m-p/303518#M312412</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-10T09:43:03Z</dc:date>
    </item>
  </channel>
</rss>

