<?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: question about infile in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596375#M171702</link>
    <description>Thank you very much for helping me understand this problem. I greatly appreciate it!</description>
    <pubDate>Mon, 14 Oct 2019 21:52:35 GMT</pubDate>
    <dc:creator>Amy0223</dc:creator>
    <dc:date>2019-10-14T21:52:35Z</dc:date>
    <item>
      <title>question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596348#M171691</link>
      <description>&lt;P&gt;Hi, I'm struggling with this question below. Your input is much appreciated!&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data all;
infile ‘ubaacs.survey.tariff ’;
input type $1. @;
if type=’m’ then do;
   input nreps 2. id $2.;
   do i=1 to nreps;
       input uear rate;
       output;
    end;
    end;
run;&lt;/PRE&gt;&lt;OL&gt;&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;What variables will be in dataset all?&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;I think they are&amp;nbsp;type, nreps, id, uear, rate. Please correct me if I'm wrong.&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Suppose the raw dataset identified by the infile statement looked like this:&lt;/STRONG&gt;&lt;P&gt;&lt;STRONG&gt;m 3us&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;87 5.4&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;88 5.15&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;89 5.0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i 1us&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;9.7 11.2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;m 2it&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;88 6.0&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;89 5.8&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What will dataset all look like???&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:00:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596348#M171691</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-10-14T19:00:34Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596353#M171694</link>
      <description>&lt;P&gt;You could actually run the code, and find out the answer that way.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 19:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596353#M171694</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-14T19:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596365#M171697</link>
      <description>Thank you. I'm not really sure how to infile this raw data in Data all in order to run the codes.</description>
      <pubDate>Mon, 14 Oct 2019 20:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596365#M171697</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-10-14T20:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596367#M171698</link>
      <description>&lt;P&gt;You create a text file, with the name given in the infile statement, and then you run the code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, it seems as if the code you showed was perhaps pasted into here from Microsoft Word, in which case all of the quotes need to be replaced with "un-curly" quotes that SAS will recognize (SAS doesn't recognize the "curly" quotes).&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 20:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596367#M171698</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-10-14T20:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596368#M171699</link>
      <description>&lt;P&gt;Let's do the computer work:&lt;/P&gt;
&lt;PRE&gt;the input              computer work
=======        ==========================
m 3us             type='m' and nreps=3 id='us'
87 5.4            rep1 ==&amp;gt; uear =88  rate=5.4
88 5.15           rep2 ==&amp;gt; complete it by yourself
89 5.0            rep3 ==&amp;gt;
i 1us             type ne 'm' ==&amp;gt; skip it
9.7 11.2          type ne 'm' ==&amp;gt; skip it
m 2it             type = 'm' and nreps=2 id='it'  
88 6.0            rep1 ==&amp;gt;
89 5.8            rep2 ==&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2019 20:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596368#M171699</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-10-14T20:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596373#M171701</link>
      <description>Thank you very much for the information. I will pay attention to it.</description>
      <pubDate>Mon, 14 Oct 2019 21:51:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596373#M171701</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-10-14T21:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596375#M171702</link>
      <description>Thank you very much for helping me understand this problem. I greatly appreciate it!</description>
      <pubDate>Mon, 14 Oct 2019 21:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596375#M171702</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-10-14T21:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596421#M171719</link>
      <description>&lt;P&gt;What variables are in the table is determined at compile time.&lt;/P&gt;
&lt;P&gt;The data has nothing to do with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hint: you forgot one variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 03:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596421#M171719</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-10-15T03:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596434#M171723</link>
      <description>&lt;P&gt;You can avoid having to access an external file by using inline data with the datalines file reference and datalines statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data all;
infile datalines;
input type $1. @;
if type = 'm' then do;
  input nreps 2. id $2.;
  do i = 1 to nreps;
    input uear rate;
    output;
  end;
end;
datalines;
m 3us
87 5.4
88 5.15
89 5.0
i 1us
9.7 11.2
m 2it
88 6.0
89 5.8
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;I corrected the artifacts of using a word processor for code&lt;/LI&gt;
&lt;LI&gt;I did some visual formatting on the code to make it readable&lt;/LI&gt;
&lt;LI&gt;I used the "little running man" button to open a window fror posting SAS code, so code is preserved as-is&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 15 Oct 2019 05:48:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596434#M171723</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-15T05:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: question about infile</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596557#M171779</link>
      <description>I was having a lot of errors when running the codes but now I understand why. You are amazing!  Thank you very much for taking your precious time to help me. I greatly appreciate it!</description>
      <pubDate>Tue, 15 Oct 2019 15:09:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-infile/m-p/596557#M171779</guid>
      <dc:creator>Amy0223</dc:creator>
      <dc:date>2019-10-15T15:09:13Z</dc:date>
    </item>
  </channel>
</rss>

