<?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 solve multiple inputs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392207#M94342</link>
    <description>Thanks...!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Thu, 31 Aug 2017 14:01:25 GMT</pubDate>
    <dc:creator>ab12nov</dc:creator>
    <dc:date>2017-08-31T14:01:25Z</dc:date>
    <item>
      <title>How to solve multiple inputs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392185#M94335</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please explain&amp;nbsp;me why the data set &lt;STRONG&gt;test&lt;/STRONG&gt; created is having &lt;STRONG&gt;Ruth idnum&lt;/STRONG&gt; as &lt;STRONG&gt;22&lt;/STRONG&gt; rather than 11 and &lt;STRONG&gt;Suey age&lt;/STRONG&gt; as &lt;STRONG&gt;40&lt;/STRONG&gt; rather than 30. This has been asked in &lt;STRONG&gt;certification exam&lt;/STRONG&gt;, so I need the clarity for the answer. Following is the program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards;
input employee_name $ 1-4;
if employee_name = 'Ruth' then input idnum 9-10;
else input age 6-7;
cards;
Ruth 39 11
Jose 32 22
Suey 30 33
John 40 44
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dataset created is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;employee_name &amp;nbsp; &amp;nbsp;idnum &amp;nbsp; &amp;nbsp;age&lt;/P&gt;&lt;P&gt;Ruth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 22 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;Suey &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; . &amp;nbsp; &amp;nbsp; &amp;nbsp; 40&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Ayushmaan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 13:27:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392185#M94335</guid>
      <dc:creator>ab12nov</dc:creator>
      <dc:date>2017-08-31T13:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve multiple inputs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392196#M94336</link>
      <description>&lt;P&gt;The first input reads positions 1-4 on line 1, and skips to line 2. The second (conditional) input reads pos. 9-10 on line 2.&lt;/P&gt;
&lt;P&gt;The observation is written, the data step iterates, reads pos. 1-4 on line 3 and skips to line4, where pos. 6-7 are read as age.&lt;/P&gt;
&lt;P&gt;You probably wanted to hold the input line:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards missover;
input employee_name $ 1-4@;
if employee_name = 'Ruth' then input idnum 9-10;
else input age 6-7;
cards;
Ruth 39 11
Jose 32 22
Suey 30 33
John 40 44
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Aug 2017 13:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392196#M94336</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-31T13:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve multiple inputs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392200#M94338</link>
      <description>&lt;P&gt;Because after executing every INPUT statement ,the pointer is going to next row.&lt;/P&gt;
&lt;P&gt;So after first input, the pointer jump into the next row,and input idnum 9-10; will input 22 ,not 11.&lt;/P&gt;
&lt;P&gt;if you want input 11, add&amp;nbsp;@ &amp;nbsp; &amp;nbsp;at the end of INPUT to avoid it to jump into next row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile cards;
input employee_name $ 1-4 @;
if employee_name = 'Ruth' then input idnum 9-10 ;
else input age 6-7;
cards;
Ruth 39 11
Jose 32 22
Suey 30 33
John 40 44
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 31 Aug 2017 13:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392200#M94338</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-08-31T13:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to solve multiple inputs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392207#M94342</link>
      <description>Thanks...!!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 31 Aug 2017 14:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-solve-multiple-inputs/m-p/392207#M94342</guid>
      <dc:creator>ab12nov</dc:creator>
      <dc:date>2017-08-31T14:01:25Z</dc:date>
    </item>
  </channel>
</rss>

