<?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: format question? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357632#M84000</link>
    <description>&lt;P&gt;Also, in answer to your other question, the informat and format statements, being before the input statement, control the order of the variables in the resulting file and it works from top to bottom the first time a variable is used. So, all of the variables that you had informats for will be the first variables in your resulting file, followed by those that weren't mentioned in your combination of informat and format statements.&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>Wed, 10 May 2017 18:31:22 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-05-10T18:31:22Z</dc:date>
    <item>
      <title>format question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357610#M83987</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to import a '.csv' file into SAS. &amp;nbsp;I found some codes from the previous programmer as the list below. &amp;nbsp;I have some questions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. &amp;nbsp;Why use "informat"&amp;nbsp;first then "format" statement? &amp;nbsp;I tried to just use the "format" statement. &amp;nbsp;I don't see any difference.&lt;/P&gt;&lt;P&gt;2. &amp;nbsp;After the file was imported, I found the order of the columns has been changed. &amp;nbsp;It changed to "JL Rating1 Rating2 Rating3&amp;nbsp;&lt;SPAN&gt;Rating4&amp;nbsp;RHSC&amp;nbsp;HTLC&amp;nbsp;LRC&amp;nbsp;VS". &amp;nbsp;Due to the rating is corresponded to its previous column name, &amp;nbsp;how to keep the order the same as input order "JL $ RHSC $ Rating1 $ HTLC $ Rating2 $ LRC $ Rating3 $ VS $ Rating4 $"? &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; test;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile test MISSOVER DSD firstobs=&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat JL $22. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat rating1 $32. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat rating2 $18. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat rating3 $100. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; informat rating4 $12. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format JL $22. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format rating1 $32. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format rating2 $18. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format rating3 $100. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format rating4 $12. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input JL $ RHSC $ Rating1 $ HTLC $ Rating2 $ LRC $ Rating3 $ VS $ Rating4 $;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Wed, 10 May 2017 17:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357610#M83987</guid>
      <dc:creator>ybz12003</dc:creator>
      <dc:date>2017-05-10T17:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: format question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357612#M83988</link>
      <description>&lt;P&gt;The appearance for the code makes me believe that may have been generated by proc import.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With simple character variables as long as the length of the variable is set before reading with either informat, format or attrib statement there isn't much difference. However for things such as Date, Datetime or Time variables you would have significantly different behavior as if SAS does not know how to read one of those then applying the format will likely result in something quite different.&lt;/P&gt;
&lt;P&gt;Consider these two reads:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data example;
   input date;
   format date date9.;
datalines;
01012017
;
run;

data example2;
   informat date mmddyy8.;
   input date;
   format date date9.;
datalines;
01012017
;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 May 2017 18:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357612#M83988</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-05-10T18:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: format question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357632#M84000</link>
      <description>&lt;P&gt;Also, in answer to your other question, the informat and format statements, being before the input statement, control the order of the variables in the resulting file and it works from top to bottom the first time a variable is used. So, all of the variables that you had informats for will be the first variables in your resulting file, followed by those that weren't mentioned in your combination of informat and format statements.&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>Wed, 10 May 2017 18:31:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/format-question/m-p/357632#M84000</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-05-10T18:31:22Z</dc:date>
    </item>
  </channel>
</rss>

