<?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: Importing a csv file in SAS, multilines problem in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178413#M45569</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Shayan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please use the below code and check.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; XYZ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;infile&lt;/SPAN&gt; "have.csv&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;DLM&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;';'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; filename$ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;500&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; filename@@ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Nov 2014 09:06:19 GMT</pubDate>
    <dc:creator>GokulShivananda</dc:creator>
    <dc:date>2014-11-20T09:06:19Z</dc:date>
    <item>
      <title>Importing a csv file in SAS, multilines problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178412#M45568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;so I need to import a csv file, delimited by ; , to a sas data set. &lt;/P&gt;&lt;P&gt;heres an idea of the data:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aaa; bbb; ccc&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;xxx; yyy; zzz&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ppp; jjj; aaaaa...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;...aaaa&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so, in the third abservation, the variable is long so that it goes to the next line of the csv file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I write some simple import proc like the below, it recognizes these new lines as new variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc import &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; datafile = "have.csv"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; out = test&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms = csv;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter = ";";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames=no;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone has a suggestion for taking care of that multi-line observations? really appreciate it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 22:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178412#M45568</guid>
      <dc:creator>Shayan2012</dc:creator>
      <dc:date>2014-11-19T22:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a csv file in SAS, multilines problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178413#M45569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Shayan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please use the below code and check.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; XYZ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;infile&lt;/SPAN&gt; "have.csv&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;"&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;DLM&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 10pt;"&gt;';'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; filename$ &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;500&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 10pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt; filename@@ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 09:06:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178413#M45569</guid>
      <dc:creator>GokulShivananda</dc:creator>
      <dc:date>2014-11-20T09:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a csv file in SAS, multilines problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178414#M45570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I check, do you mean that the line in your text editor just wraps due to space limitations in the editor, or that there is actually embedded line break codes within that data.&amp;nbsp; The way to do this is to use a free Hex editor (Google, there is lots of free ones), goto a place where you know there is a break and look at the actual Hex code where the line splits.&amp;nbsp; If you see 0A0D or similar then you have more problems than just a long string.&amp;nbsp; Have a look at my post here: &lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/thread/60374"&gt;https://communities.sas.com/thread/60374&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Where I have some correspondence with Tech Support.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If its just a long of text (and why would you have text that long anyways?) something like GokulShivananda has posted would be suggested.&amp;nbsp; As always I would avoid the use of proc import at all.&amp;nbsp; Write the code yourself and you know what your data looks like and what you want, proc import is all guess work.&amp;nbsp; If you have further problems with the code above, remember the infile options - lrecl, dsd, missover etc. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 09:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178414#M45570</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-20T09:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a csv file in SAS, multilines problem</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178415#M45571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should throw proc import away under this situation. use recfm=n to take it as a stream file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;filename x 'c:\temp\have.txt';
data have;
infile x DLM=';' recfm=n;
length filename$ 500;
input filename@@ ;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 13:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Importing-a-csv-file-in-SAS-multilines-problem/m-p/178415#M45571</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-20T13:54:48Z</dc:date>
    </item>
  </channel>
</rss>

