<?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: Basics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354797#M83045</link>
    <description>&lt;P&gt;Run the step first. Then apply your knowledge about "data step concepts" (if this is not yet present, get it through googling for the phrase and study the respective SAS documentation) to the result, and you will arrive at the answer.&lt;/P&gt;
&lt;P&gt;The intent of such exercises is that&amp;nbsp;&lt;STRONG&gt;you&lt;/STRONG&gt; find the answer (and thus hone your skills), not somebody else.&lt;/P&gt;</description>
    <pubDate>Sun, 30 Apr 2017 09:54:02 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-04-30T09:54:02Z</dc:date>
    <item>
      <title>Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354796#M83044</link>
      <description>&lt;DIV&gt;---I----1 0---I----20---I----30&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Ruth 39 11&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Jose 32 22&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sue 30 33&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;John 40 44&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The following SAS program is submitted:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data test;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;infile ‘employee’;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;input employee_name $ 1-4;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;if employee_name = ‘Ruth’ then input idnum 10-11;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;else input age 7-8;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;run;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;What value does the variable IDNUM contain when the name of the employee is “Ruth”?&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have no clue how to deduct the answer.Please help me with reason.Answer for this question is appreciated.However, I need an explanation.thanks in advance.&lt;/DIV&gt;</description>
      <pubDate>Sun, 30 Apr 2017 09:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354796#M83044</guid>
      <dc:creator>Sathiskumar_D</dc:creator>
      <dc:date>2017-04-30T09:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354797#M83045</link>
      <description>&lt;P&gt;Run the step first. Then apply your knowledge about "data step concepts" (if this is not yet present, get it through googling for the phrase and study the respective SAS documentation) to the result, and you will arrive at the answer.&lt;/P&gt;
&lt;P&gt;The intent of such exercises is that&amp;nbsp;&lt;STRONG&gt;you&lt;/STRONG&gt; find the answer (and thus hone your skills), not somebody else.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 09:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354797#M83045</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-04-30T09:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354803#M83049</link>
      <description>&lt;P&gt;Since you didn't add&amp;nbsp;@ at the end of "&lt;SPAN&gt;input employee_name $ 1-4; ".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;that means point will go to the next row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;it should be 22 .&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 12:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354803#M83049</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-04-30T12:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354813#M83052</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;that you really should first experiement and see if you can answer the questions yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there really are blank lines between each record, the code won't even run. And, if there aren't blank lines between each record, and the data are exactly the way you&amp;nbsp;entered them, then the answer is 2 as SAS will try to read two digits beginning in column 10, but only one digit exists there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 14:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354813#M83052</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-04-30T14:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354814#M83053</link>
      <description>Hi:&lt;BR /&gt;  If this is an interview or homework question, then you have everything you need to run the program and test it to understand how the INFILE statement works when coded as you show.&lt;BR /&gt; &lt;BR /&gt;cynthia</description>
      <pubDate>Sun, 30 Apr 2017 14:31:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354814#M83053</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-04-30T14:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354821#M83057</link>
      <description>Thanks Mr.Ksharp. I am still novice to SAS and still in the learning curve.I couldn't run this program in SAS studio.I tried it.It showing the syntax error.That's why i posted in this forum.Will read the basics again.</description>
      <pubDate>Sun, 30 Apr 2017 17:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354821#M83057</guid>
      <dc:creator>Sathiskumar_D</dc:creator>
      <dc:date>2017-04-30T17:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354823#M83058</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; To test the program, you either would have needed to make a file called "employee" and type the datalines into the file or modify the program slightly to use the INFILE DATALINES technique for reading in test data. Here's an example of using INFILE DATALINES:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test; 
  infile datalines; 
  input employee_name $ 1-4; 
  if employee_name = 'Ruth' then input idnum 10-11; 
  else input age 7-8; 
datalines;
Ruth  39 11 
Jose  32 22 
Sue   30 33 
John  40 44 
; 
run; 
proc print data=test;
  title '1) After running original program';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; We do show this technique in our Programming 1 class and the technique of using DATALINES to provide a program with "instream" data is well documented.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Then, once you run the program and see that KSharp was correct, that the value would be 22 -- as shown below:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8638iE1A7B3D3AC6DA43D/image-size/original?v=1.0&amp;amp;px=-1" alt="input_statement_behavior.png" title="input_statement_behavior.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;--then you can read about using the single trailing @ sign to modify the behavior of the INPUT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Every time an INPUT statement is encountered in a program, (EVERY time), a new row or new dataline is loaded into the INPUT buffer area. So without any other controls in place, SAS will go to a new dataline after reading the name on the first row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 18:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354823#M83058</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-04-30T18:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354826#M83060</link>
      <description>&lt;P&gt;Thanks &amp;nbsp;a lot for showing the program in detail .I did something when writing this program in SAS studio.I'll fix it and run.&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 18:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354826#M83060</guid>
      <dc:creator>Sathiskumar_D</dc:creator>
      <dc:date>2017-04-30T18:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354954#M83100</link>
      <description>&lt;P&gt;ans is 22. because when you put input statement again after then.. then it will take value of next variable.(as per my knowledge)&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 14:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354954#M83100</guid>
      <dc:creator>napatel0911</dc:creator>
      <dc:date>2017-05-01T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: Basics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354957#M83102</link>
      <description>&lt;P&gt;It is a very good idea to post code and example data using codeboxes opened with the forum {i} menu icon.&lt;/P&gt;
&lt;P&gt;As &lt;STRONG&gt;posted&lt;/STRONG&gt; your code won't produce very similar results as the forum window has likely inserted additional blank lines.&lt;/P&gt;</description>
      <pubDate>Mon, 01 May 2017 14:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Basics/m-p/354957#M83102</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-01T14:55:19Z</dc:date>
    </item>
  </channel>
</rss>

