<?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: Different input pointer position after reading char/numeric/informat variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804506#M33418</link>
    <description>&lt;P&gt;The main difference is that the cursor is positioned differently when you read a value in LIST MODE than when you read it in FORMATTED MODE.&amp;nbsp; With FORMATTED MODE then an exact number of bytes are read.&amp;nbsp; With LIST MODE then next "word" on the line is read.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to specify an informat in-line in the INPUT statement and still use LIST MODE input then add the colon modifier before the informat.&amp;nbsp; When reading in list mode the width of the informat is ignored, the whole next "word" on the line is read.&amp;nbsp; So no need to add the 5 width to the COMMA informat specification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   input name $ income :comma.;
datalines;
Tom   1,098
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Mar 2022 13:42:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-03-28T13:42:25Z</dc:date>
    <item>
      <title>Different input pointer position after reading char/numeric/informat variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804505#M33417</link>
      <description>&lt;P&gt;I have the following three data steps, each of which reads in two variables from the embedded raw data. The two variables are separated by THREE spaces in all cases. See SAS code below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data Char;
   input name $ +2 income comma5.;
   datalines;
Tom   1,098
   ;
run;

data Num;
   input id +2 income comma5.;
   datalines;
123   1,098
   ;
run;

data Informat;
   input balance comma5. +3 income comma5.;
   datalines;
5,123   1,098
   ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;As you can see, for the char and numeric variables, I need to do a +2 on the input pointer for the following informat to work; however, if the first variable uses an informat, it needs a +3 on the pointer. Can someone please explain this difference of pointer position?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 13:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804505#M33417</guid>
      <dc:creator>kingcu</dc:creator>
      <dc:date>2022-03-28T13:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Different input pointer position after reading char/numeric/informat variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804506#M33418</link>
      <description>&lt;P&gt;The main difference is that the cursor is positioned differently when you read a value in LIST MODE than when you read it in FORMATTED MODE.&amp;nbsp; With FORMATTED MODE then an exact number of bytes are read.&amp;nbsp; With LIST MODE then next "word" on the line is read.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to specify an informat in-line in the INPUT statement and still use LIST MODE input then add the colon modifier before the informat.&amp;nbsp; When reading in list mode the width of the informat is ignored, the whole next "word" on the line is read.&amp;nbsp; So no need to add the 5 width to the COMMA informat specification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   input name $ income :comma.;
datalines;
Tom   1,098
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2022 13:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804506#M33418</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-28T13:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Different input pointer position after reading char/numeric/informat variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804508#M33419</link>
      <description>&lt;P&gt;If you want to see how the pointing is positioned use the COLUMN= infile option.&lt;/P&gt;
&lt;PRE&gt;17    data Char;
18       infile datalines column=col ;
19       input name $ @;
20       put col=;
21       input +2 income comma5.;
22    datalines;

col=5
NOTE: The data set WORK.CHAR has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.03 seconds
      cpu time            0.00 seconds


24    ;
25
26    data Num;
27       infile datalines column=col ;
28       input id @;
29       put col=;
30       input +2 income comma5.;
31    datalines;

col=5
NOTE: The data set WORK.NUM has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


33    ;
34
35    data Informat;
36       infile datalines column=col ;
37       input balance comma5. @;
38       put col=;
39       input  +3 income comma5.;
40    datalines;

col=6
NOTE: The data set WORK.INFORMAT has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Mar 2022 13:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804508#M33419</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-28T13:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: Different input pointer position after reading char/numeric/informat variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804517#M33420</link>
      <description>Thanks, the colon modifier works like a charm.</description>
      <pubDate>Mon, 28 Mar 2022 14:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Different-input-pointer-position-after-reading-char-numeric/m-p/804517#M33420</guid>
      <dc:creator>kingcu</dc:creator>
      <dc:date>2022-03-28T14:24:11Z</dc:date>
    </item>
  </channel>
</rss>

