<?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 import the structured txt file ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725979#M225573</link>
    <description>&lt;P&gt;The colon modifier on the input statement let's you include an in-line informat in the INPUT statement without actually switching from using LIST mode input (read the next "word" in the line) to FORMATTED mode input (read EXACTLY the number of characters I tell you to read).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allowed me to skip defining the length of the FILE variable since SAS will assume since I am using the character informat with a width of 200 that the variable should be character with a length of 200.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'c:\downloads\Liste.txt' dlm='[,]' recfm=n;
  length file $200 ;
  input file @@;
  file=dequote(file);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 12 Mar 2021 20:42:31 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-03-12T20:42:31Z</dc:date>
    <item>
      <title>How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725881#M225551</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have the file (herewith attached), I don't know the number of variables in it, so I can't procced with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;infile\informat\format and input. I'm wondering if there is another way to import the txt. I know that proc import doesn't work with txt.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help !&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:06:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725881#M225551</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-12T19:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725899#M225559</link>
      <description>&lt;P&gt;Doesn't look "structured" to me. It just seems to be a list of filenames.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'c:\downloads\Liste.txt' dlm='[,]' recfm=n;
  input file :$200. @@;
  file=dequote(file);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Mar 2021 19:40:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725899#M225559</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-12T19:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725910#M225567</link>
      <description>&lt;P&gt;Your "text" file doesn't have any end of line markers which adds a bit of complication. It also appears to have exactly one variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I &lt;STRONG&gt;think&lt;/STRONG&gt; this works :&lt;/P&gt;
&lt;PRE&gt;data junk;
  infile "&amp;lt;path&amp;gt;\liste.txt" dlm='[],' recfm=n ;
  informat a $35.;
  input a @@;
run;&lt;/PRE&gt;
&lt;P&gt;The RECFM option treats the input file as a single stream. Because your data starts with a [ and ends with ] I include them as delimiters along with the comma.&lt;/P&gt;
&lt;P&gt;INPUT a @@ basically means "keep reading repeatedly".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I made a guess as to the variable length. Sue me if it is wrong. You may want to remove the quotes around the values.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 20:11:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725910#M225567</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-12T20:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725976#M225572</link>
      <description>Thank you, Tom ! That works.&lt;BR /&gt;What means the ":" before $200. ?</description>
      <pubDate>Fri, 12 Mar 2021 20:37:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725976#M225572</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-12T20:37:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725979#M225573</link>
      <description>&lt;P&gt;The colon modifier on the input statement let's you include an in-line informat in the INPUT statement without actually switching from using LIST mode input (read the next "word" in the line) to FORMATTED mode input (read EXACTLY the number of characters I tell you to read).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allowed me to skip defining the length of the FILE variable since SAS will assume since I am using the character informat with a width of 200 that the variable should be character with a length of 200.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile 'c:\downloads\Liste.txt' dlm='[,]' recfm=n;
  length file $200 ;
  input file @@;
  file=dequote(file);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Mar 2021 20:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725979#M225573</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-12T20:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725981#M225574</link>
      <description>Thank you, Tom !</description>
      <pubDate>Fri, 12 Mar 2021 20:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725981#M225574</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-12T20:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725982#M225575</link>
      <description>Tom, last question: what means @@ after "file" ? Thank you !</description>
      <pubDate>Fri, 12 Mar 2021 20:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725982#M225575</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-12T20:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725990#M225576</link>
      <description>&lt;P&gt;On an INPUT statement the trailing&amp;nbsp;@ has an impact on how the line and column pointer moves.&lt;/P&gt;
&lt;P&gt;The "double trailing at" means to keep the pointer exactly where it is even when starting another iteration of the data step.&amp;nbsp; So you can read multiple observations from the the same line of input text.&lt;/P&gt;
&lt;P&gt;The "single trailing at" also means to keep the pointer where it is, but only for any other input statements in this same iteration of the data step.&amp;nbsp; The next iteration will start at the beginning of the next line of input text.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Mar 2021 21:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725990#M225576</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-12T21:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725995#M225577</link>
      <description>Thank you very much, Tom !</description>
      <pubDate>Fri, 12 Mar 2021 21:48:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/725995#M225577</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-12T21:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726036#M225596</link>
      <description>Hello Tom,&lt;BR /&gt;When I run the program with @@ I have the same results as with one @. Could you explain please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you !&lt;BR /&gt;Marie</description>
      <pubDate>Sat, 13 Mar 2021 10:53:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726036#M225596</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-13T10:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726045#M225599</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hello Tom,&lt;BR /&gt;When I run the program with @@ I have the same results as with one @. Could you explain please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you !&lt;BR /&gt;Marie&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is because of the RECFM=N.&amp;nbsp; SAS is not treating the input as lines of text, just a stream of data.&amp;nbsp; Try the single and double at without the RECFM=N on the INFILE statement and see if you get different behavior.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 15:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726045#M225599</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-13T15:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the structured txt file ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726046#M225600</link>
      <description>Thank you, Tom !</description>
      <pubDate>Sat, 13 Mar 2021 15:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-structured-txt-file/m-p/726046#M225600</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2021-03-13T15:17:45Z</dc:date>
    </item>
  </channel>
</rss>

