<?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: Reading dataset using input - incorrect results in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277497#M55734</link>
    <description>&lt;P&gt;You have different alternative that work fine&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input AESER $ @2 AESDTH $ @4 AESLIFE $ @6 AESHOSP $ @8 AESCONG $ @10 AESDISAB $ @12 AESMIE $ @14 INFECDIS $;
datalines;
N N N N N N N N
Y N N N N N N N
Y Y N N N N Y N
Y Y Y N N N N N
;
run;

data one;
input AESER $  AESDTH $  AESLIFE $  AESHOSP $  AESCONG $  AESDISAB $  AESMIE $  INFECDIS $;
datalines;
N N N N N N N N
Y N N N N N N N
Y Y N N N N Y N
Y Y Y N N N N N
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You don't need the +1 that mean skip it a column.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jun 2016 07:40:08 GMT</pubDate>
    <dc:creator>arodriguez</dc:creator>
    <dc:date>2016-06-15T07:40:08Z</dc:date>
    <item>
      <title>Reading dataset using input - incorrect results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277441#M55706</link>
      <description>&lt;P&gt;Dear sir,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to read the data using the following code. I am not getting the output as shown in datalines statement. Only first observation I am getting exactly. For next observations all values are "Y". Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data one;&lt;BR /&gt;input AESER $1 +1 AESDTH $1 +1 AESLIFE $1 +1 AESHOSP $1 +1 AESCONG $1 +1 AESDISAB $1 +1 AESMIE $1 +1 INFECDIS $1;&lt;BR /&gt;datalines;&lt;BR /&gt;N N N N N N N N&lt;BR /&gt;Y N N N N N N N&lt;BR /&gt;Y Y N N N N Y N&lt;BR /&gt;Y Y Y N N N N N&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 05:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277441#M55706</guid>
      <dc:creator>knveraraju91</dc:creator>
      <dc:date>2016-06-15T05:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dataset using input - incorrect results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277497#M55734</link>
      <description>&lt;P&gt;You have different alternative that work fine&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data one;
input AESER $ @2 AESDTH $ @4 AESLIFE $ @6 AESHOSP $ @8 AESCONG $ @10 AESDISAB $ @12 AESMIE $ @14 INFECDIS $;
datalines;
N N N N N N N N
Y N N N N N N N
Y Y N N N N Y N
Y Y Y N N N N N
;
run;

data one;
input AESER $  AESDTH $  AESLIFE $  AESHOSP $  AESCONG $  AESDISAB $  AESMIE $  INFECDIS $;
datalines;
N N N N N N N N
Y N N N N N N N
Y Y N N N N Y N
Y Y Y N N N N N
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You don't need the +1 that mean skip it a column.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 07:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277497#M55734</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-06-15T07:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dataset using input - incorrect results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277528#M55748</link>
      <description>&lt;P&gt;WIthin an INPUT statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;$1 = read the contents of column 1&lt;/P&gt;
&lt;P&gt;$1. = read the next column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you have one space between data values, you would need to change all occurrences of "$1" to "$1.".&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 10:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277528#M55748</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-06-15T10:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Reading dataset using input - incorrect results</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277531#M55749</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/68272"&gt;@knveraraju91﻿&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While I was writing my post,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding﻿&lt;/a&gt;&amp;nbsp;has already given the explanation ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The explanation why your code failed is: You used &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl/en/lestmtsref/68024/HTML/default/n13ejk9swz5vrbn0z34iazfrp0wp.htm" target="_blank"&gt;column input&lt;/A&gt; inadvertently. SAS interpreted the specification "$1" as "read character value from column 1." Hence, all of your variables received the first letter in each line, the other letters were ignored. So, it only &lt;EM&gt;seemed&lt;/EM&gt; that the first line was read correctly, because all letters happened to be equal to the first one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you probably &lt;EM&gt;wanted&lt;/EM&gt; to do was &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl/en/lestmtsref/68024/HTML/default/p0f9yk6pd4znukn1rlw6hzkg1url.htm" target="_blank"&gt;formatted input&lt;/A&gt;, but informat specifications such as $1&lt;FONT size="3" color="#FF0000"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/FONT&gt; require a period. The following INPUT statement is correct:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input AESER $1. +1 AESDTH $1. +1 AESLIFE $1. +1 AESHOSP $1. +1 AESCONG $1. +1 AESDISAB $1. +1 AESMIE $1. +1 INFECDIS $1.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the "+1" pointer controls make sense, because with formatted input the blanks between the values are not skipped automatically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input style which&amp;nbsp;&lt;SPAN&gt;skips blanks automatically (but which also &lt;EM&gt;requires&lt;/EM&gt; blanks or other delimiters between data values) is &lt;A href="http://support.sas.com/documentation/cdl/en/syntaxidx/68719/HTML/default/index.htm#/documentation/cdl/en/lestmtsref/68024/HTML/default/n0lrz3gb7m9e4rn137op544ddg0v.htm" target="_blank"&gt;list input&lt;/A&gt;. This in turn can be combined with informat specifications (which in your example have the main purpose of assigning type character and length 1 to the variables) and is then called &lt;EM&gt;modified list input&lt;/EM&gt;:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input AESER :$1. AESDTH :$1. AESLIFE :$1. AESHOSP :$1. AESCONG :$1. AESDISAB :$1. AESMIE :$1. INFECDIS :$1.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;All of these repetitive specifications can be abbreviated by using parenthesized lists of variable names and informat specifications. In particular, modified list input could be written as:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input (AESER AESDTH AESLIFE AESHOSP AESCONG AESDISAB AESMIE INFECDIS) (:$1.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2016 11:08:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-dataset-using-input-incorrect-results/m-p/277531#M55749</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-06-15T11:08:23Z</dc:date>
    </item>
  </channel>
</rss>

