<?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 Data processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-processing/m-p/556390#M155001</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Below&amp;nbsp;2 data steps are for processing same data. Though, the data is same, the output is different. The significance of "+1" is to ignore 1 space so that the succeeding data will be considered for next variable/column. Even though, the data should not differ in output of Program 2 from that of Program&amp;nbsp;1 , I find difference in the output. Could you please explain why is it so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Program 1:&lt;/U&gt;&lt;BR /&gt;data work.voter;&lt;BR /&gt;input Age Party : $1. (Ques1-Ques4) ($1. +1);&lt;BR /&gt;datalines;&lt;BR /&gt;23 D 1 1 2 2&lt;BR /&gt;45 R 5 5 4 1&lt;BR /&gt;67 D 2 4 3 3&lt;BR /&gt;39 R 4 4 4 4&lt;BR /&gt;19 D 2 1 2 1&lt;BR /&gt;75 D 3 3 2 3&lt;BR /&gt;57 R 4 3 4 4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Program 2:&lt;/U&gt;&lt;BR /&gt;data voter2;&lt;BR /&gt;input Age Party : $1. (Ques1-Ques4) ($1.);&lt;BR /&gt;datalines;&lt;BR /&gt;23 D 1 1 2 2&lt;BR /&gt;45 R 5 5 4 1&lt;BR /&gt;67 D 2 4 3 3&lt;BR /&gt;39 R 4 4 4 4&lt;BR /&gt;19 D 2 1 2 1&lt;BR /&gt;75 D 3 3 2 3&lt;BR /&gt;57 R 4 3 4 4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Mon, 06 May 2019 11:56:52 GMT</pubDate>
    <dc:creator>nimmy_mj</dc:creator>
    <dc:date>2019-05-06T11:56:52Z</dc:date>
    <item>
      <title>Data processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-processing/m-p/556390#M155001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Below&amp;nbsp;2 data steps are for processing same data. Though, the data is same, the output is different. The significance of "+1" is to ignore 1 space so that the succeeding data will be considered for next variable/column. Even though, the data should not differ in output of Program 2 from that of Program&amp;nbsp;1 , I find difference in the output. Could you please explain why is it so?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Program 1:&lt;/U&gt;&lt;BR /&gt;data work.voter;&lt;BR /&gt;input Age Party : $1. (Ques1-Ques4) ($1. +1);&lt;BR /&gt;datalines;&lt;BR /&gt;23 D 1 1 2 2&lt;BR /&gt;45 R 5 5 4 1&lt;BR /&gt;67 D 2 4 3 3&lt;BR /&gt;39 R 4 4 4 4&lt;BR /&gt;19 D 2 1 2 1&lt;BR /&gt;75 D 3 3 2 3&lt;BR /&gt;57 R 4 3 4 4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Program 2:&lt;/U&gt;&lt;BR /&gt;data voter2;&lt;BR /&gt;input Age Party : $1. (Ques1-Ques4) ($1.);&lt;BR /&gt;datalines;&lt;BR /&gt;23 D 1 1 2 2&lt;BR /&gt;45 R 5 5 4 1&lt;BR /&gt;67 D 2 4 3 3&lt;BR /&gt;39 R 4 4 4 4&lt;BR /&gt;19 D 2 1 2 1&lt;BR /&gt;75 D 3 3 2 3&lt;BR /&gt;57 R 4 3 4 4&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 11:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-processing/m-p/556390#M155001</guid>
      <dc:creator>nimmy_mj</dc:creator>
      <dc:date>2019-05-06T11:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Data processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-processing/m-p/556393#M155002</link>
      <description>&lt;P&gt;As the &lt;A href="https://documentation.sas.com/?docsetId=lestmtsref&amp;amp;docsetTarget=n0oaql83drile0n141pdacojq97s.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=da" target="_self"&gt;SAS Documentation for the INPUT Statement&lt;/A&gt; says:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;+n moves the pointer&amp;nbsp;&lt;SPAN class="xis-userSuppliedValue"&gt;n&lt;/SPAN&gt;&amp;nbsp;columns.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consequently, you take explicit control of the input pointer in your first data step and correctly jump over the spaces. In your second data step, the data step reads just a single character (as you instruct it to) regardless of whether it is a space or not.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consequently, if your INPUT Statement in the second data step should produce the same output as the first one, your data should look like this (i don't recommend it, but I post it for clarification)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;cdata voter2;
input Age Party : $1. (Ques1-Ques4) ($1.);
datalines;
23 D 1122
45 R 5541
67 D 2433
39 R 4444
19 D 2121
75 D 3323
57 R 4344
;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Or you can simply add a colon to your input statement like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data voter2;
input Age Party : $1. (Ques1-Ques4) (:$1);
datalines;
23 D 1 1 2 2
45 R 5 5 4 1
67 D 2 4 3 3
39 R 4 4 4 4
19 D 2 1 2 1
75 D 3 3 2 3
57 R 4 3 4 4
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 12:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-processing/m-p/556393#M155002</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-05-06T12:20:23Z</dc:date>
    </item>
  </channel>
</rss>

