<?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 How do I tell SAS NOT to delimit by space and/or comma? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811437#M320050</link>
    <description>&lt;P&gt;Dear SAS Community:&lt;/P&gt;&lt;P&gt;I want to import a .dat file that is tab delimited. Here is the file (also attached to post):&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/kb/34/436.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/34/436.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"Artists.dat", under the "Downloads" tab&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I import it using the INFILE statement, it would create a separate column for every space it encounters, rather than using solely the tab (five spaces). Here is the code I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA artists;&lt;BR /&gt;INFILE 'file_location/file_name';&lt;BR /&gt;INPUT Name $ Genre $ Nation $;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result each artist's name, rather than being in a single column, gets divided into separate columns (2 or 3) because of the spaces between the artist's first and last names. Is this a problem of the source data format? Thank you for any advise,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2022 13:25:11 GMT</pubDate>
    <dc:creator>howardtsai</dc:creator>
    <dc:date>2022-05-04T13:25:11Z</dc:date>
    <item>
      <title>How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811437#M320050</link>
      <description>&lt;P&gt;Dear SAS Community:&lt;/P&gt;&lt;P&gt;I want to import a .dat file that is tab delimited. Here is the file (also attached to post):&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/kb/34/436.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/34/436.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;"Artists.dat", under the "Downloads" tab&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I import it using the INFILE statement, it would create a separate column for every space it encounters, rather than using solely the tab (five spaces). Here is the code I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA artists;&lt;BR /&gt;INFILE 'file_location/file_name';&lt;BR /&gt;INPUT Name $ Genre $ Nation $;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result each artist's name, rather than being in a single column, gets divided into separate columns (2 or 3) because of the spaces between the artist's first and last names. Is this a problem of the source data format? Thank you for any advise,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811437#M320050</guid>
      <dc:creator>howardtsai</dc:creator>
      <dc:date>2022-05-04T13:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811443#M320055</link>
      <description>&lt;P&gt;Is the delimiter an actual tab character, or is the delimiter five spaces?&amp;nbsp; &amp;nbsp;Big difference. : )&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811443#M320055</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-04T13:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811447#M320058</link>
      <description>&lt;P&gt;Good question -- it seems like it is actually FIVE spaces in the .txt (after I convert it from .dat) file, and not an actual tab. What makes this a headache is that sometimes the values are divided by less than 5 spaces (3-4 spaces). Just seems like the original data file (artists.txt) wasn't written clearly in the first place.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811447#M320058</guid>
      <dc:creator>howardtsai</dc:creator>
      <dc:date>2022-05-04T13:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811449#M320060</link>
      <description>&lt;P&gt;If there is a variable number of spaces between values, I would think the easiest thing would be to let SAS use a space as delimiter, and then change your code to read FirstName and LastName separately.&amp;nbsp; As long as there are no spaces within a FirstName or LastName, that should work.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 13:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811449#M320060</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-04T13:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811452#M320062</link>
      <description>&lt;P&gt;Thank you! I had tried that too, but what complicates it further (arrgh) is artist names with multiple spaces, like "Pierre August Renoir" and "Vincent van Gogh." It's an easy fix, I can just squish the middle and last names together by deleting the space in the original data file. Still, even this simple example has created so much problems that I was just curious about potential solutions.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Howard&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 14:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811452#M320062</guid>
      <dc:creator>howardtsai</dc:creator>
      <dc:date>2022-05-04T14:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811461#M320067</link>
      <description>&lt;P&gt;Yeah, that's rough.&amp;nbsp; : )&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you look at the data (I haven't), is there a delimiter?&amp;nbsp; Cleary single space is not a delimiter.&amp;nbsp; Could you use two (or more) spaces as a delimiter?&amp;nbsp; If so, maybe try specifying dlmstr='&amp;nbsp; ' and see if that might help, something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data artists;
  INFILE cards dlmstr='  ';
  INPUT Name :$20. Genre :$20. Nation :$20.;
cards;
Vince Van Gogh   Impressionist      Netherlands
Pablo Picasso      Cubism      Spain
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I think something like that would handle the rule that the delimiter is "at least two spaces".&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So first step would be identify what you can use a as a delimiter.&amp;nbsp; Then specify it with dlmstr= option if the delimiter is multiple characters.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 14:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811461#M320067</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-04T14:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811463#M320068</link>
      <description>&lt;P&gt;Well, I'm confused.&amp;nbsp; I just clicked on the link in your question, and it looks like it shows how to read the file, using column input:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   INPUT Name $ 1-21 Genre $ 23-40 Origin $ 42;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If the data are not delimited, but they are in fixed columns, then column input makes sense.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 14:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811463#M320068</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-04T14:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811631#M320149</link>
      <description>&lt;P&gt;AH yes that must be it -- I got the two kinds of data confused! Thank you so much Quentin for your help,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Howard&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 10:27:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811631#M320149</guid>
      <dc:creator>howardtsai</dc:creator>
      <dc:date>2022-05-05T10:27:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811644#M320154</link>
      <description>&lt;P&gt;Glad you got it working.&amp;nbsp; There are LOTS of ways to read from a text file in SAS.&amp;nbsp; I forget all the names (list input, formatted, column .... ?)&amp;nbsp; &amp;nbsp;SAS may be known for analytics, but it's ability to read data from just about any source truly makes it a standout in the ETL world.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I took SAS Programming II in the Prudential Center in Boston in 1998, and managed to hold onto the course notes with my handwritten notes for about 10 years before somehow managing to lose it.&amp;nbsp; &amp;nbsp;It had an excellent chapter on reading text files, and the instructor added his own tips. Now every time I try to read in a text file (which is only once or twice a year, since most data I work with now is in a database or JSON or similar), I still instinctively reach for the course notes and feel the despair of its loss. : )&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 11:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/811644#M320154</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-05-05T11:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I tell SAS NOT to delimit by space and/or comma?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/815578#M321917</link>
      <description>&lt;P&gt;Thank you so much Quentin! Yeah I have old college handwritten notes as well....I converted a lot of them into PDF so that was nice. I still enjoy taking notes by hand!&lt;/P&gt;</description>
      <pubDate>Sun, 29 May 2022 11:12:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-tell-SAS-NOT-to-delimit-by-space-and-or-comma/m-p/815578#M321917</guid>
      <dc:creator>howardtsai</dc:creator>
      <dc:date>2022-05-29T11:12:40Z</dc:date>
    </item>
  </channel>
</rss>

