<?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 use the ?? informat modifier for multiple variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780417#M248675</link>
    <description>&lt;P&gt;When using the (variable list) (format list) syntax in the INPUT statement the list of formats is recycled until the all of the variables are input.&amp;nbsp; Just like the old FORTRAN IV FORMAT statement.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 13:23:32 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-11-16T13:23:32Z</dc:date>
    <item>
      <title>How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780234#M248590</link>
      <description>&lt;P&gt;I am reading some data from a .csv file, e.g.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile input dsd delimiter=';';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the rows are numeric data for a month. To read them I specify an informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat JAN--DEC numx5.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then I read them using e.g.&amp;nbsp;&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;input someothervariables JAN--DEC;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But a lot of the columns contain various errors (that's expected), so I would like to read using a ?? informat modifier.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But how can I do that when reading from a delimited file, using the informat in the INPUT statement like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input someothervariables (JAN--DEC) (12*?? numx5.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will make the informat "eat" a lot of the delimiters, and terrible things will happen. Any suggestions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 14:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780234#M248590</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2021-11-15T14:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780243#M248593</link>
      <description>&lt;P&gt;I think your main problem is defining the Month variable.&amp;nbsp; You can't use -- to define a variable list.&lt;/P&gt;
&lt;P&gt;In other words this cannot be used to define months Feb .. Nov&lt;/P&gt;
&lt;PRE class="language-sas"&gt;&lt;CODE&gt;informat JAN--DEC numx5.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here use length statement then use double-dash list in INPUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   infile cards dsd dlm=';' missover;
   length Jan Feb Mar Apr May Jun 8;
   input (jan--jun)(:numx. ??);
   cards4;
1;2;3,4;x4;5;6;7
;;;;
   run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Nov 2021 14:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780243#M248593</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2021-11-15T14:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780259#M248603</link>
      <description>&lt;P&gt;Since you already attached the INFORMAT you just need to use the ?? modifier in the INPUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input someothervariables (JAN--DEC) (??);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to specify an INFORMAT in the INPUT statement and still process the line using LIST MODE input you need to use the : modifier.&amp;nbsp; So include both the : and ?? modifiers.&amp;nbsp; When reading in LIST MODE there is no need to specify a width on the informat, it will be ignored anyway as in LIST MODE the whole next word is read.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input someothervariables (JAN--DEC) (?? :numx.);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 15:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780259#M248603</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-15T15:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780358#M248640</link>
      <description>&lt;P&gt;I do not have any problems defining the month variables, I do that with an informat statement, and afterwards I can input them and declare an array using the double dash notation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that, thanks for reminding me of the colon notation for informats, also a good solution.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 08:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780358#M248640</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2021-11-16T08:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780359#M248641</link>
      <description>&lt;P&gt;So it is really that simple? Thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 08:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780359#M248641</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2021-11-16T08:15:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the ?? informat modifier for multiple variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780417#M248675</link>
      <description>&lt;P&gt;When using the (variable list) (format list) syntax in the INPUT statement the list of formats is recycled until the all of the variables are input.&amp;nbsp; Just like the old FORTRAN IV FORMAT statement.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 13:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-the-informat-modifier-for-multiple-variables/m-p/780417#M248675</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-16T13:23:32Z</dc:date>
    </item>
  </channel>
</rss>

