<?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: Regular data import had a 1 time change in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701982#M214994</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267404"&gt;@appletop&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the INFORMAT statement you permanently associated the user-defined informat &lt;FONT face="courier new,courier"&gt;truefalseformat&lt;/FONT&gt; to certain variables, i.e., the name of the informat is contained in the metadata of the dataset and causes problems if it's not found in the available format catalogs (&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=p1fvn6rwmpf1njn1whkud1hmsc97.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FMTSEARCH= system option&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid these problems, you should have used the informat specification &lt;EM&gt;only in the INPUT statement&lt;/EM&gt;, e.g.,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input aaa :$5. bbb :truefalseformat.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;for list input. I virtually never use the INFORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To remove the (mostly) unnecessary informat from a variable like &lt;FONT face="courier new,courier"&gt;bbb&lt;/FONT&gt; in the existing dataset, you can use PROC DATASETS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
modify mydata;
informat bbb;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I typically use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat _all_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in the PROC DATASETS step to remove &lt;EM&gt;all&lt;/EM&gt; informats.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Nov 2020 10:35:58 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2020-11-27T10:35:58Z</dc:date>
    <item>
      <title>Regular data import had a 1 time change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701979#M214992</link>
      <description>&lt;P&gt;Every month I receive a data set as a flat-file, and import it into SAS. Last month, it arrived with binary variables stored as True / False instead of 1/0. This month it's back to 1/0, with an apology for the annoyance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a custom format like:&lt;/P&gt;&lt;PRE&gt;proc format;
  invalue truefalseformat
    'True'=1
    'False'=0;
run;
&lt;BR /&gt;data mydata;&lt;BR /&gt;   infile &amp;amp;myfile delimiter = '|' MISSOVER DSD lrecl=32767 firstobs=2;&lt;BR /&gt;     informat aaa $5.;&lt;BR /&gt;     informat bbb truefalseformat.;&lt;BR /&gt;   input &lt;BR /&gt;     aaa $&lt;BR /&gt;     bbb&lt;BR /&gt;    ;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;and edited my import script for the relevant variables. But now I need to run the proc format code every SAS session that I want to look at the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can&amp;nbsp; I change my script so that on or after import the variables are actually changed from True/False to 1/0 in the data and so I don't need to run the proc format code every time?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&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;</description>
      <pubDate>Fri, 27 Nov 2020 09:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701979#M214992</guid>
      <dc:creator>appletop</dc:creator>
      <dc:date>2020-11-27T09:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regular data import had a 1 time change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701980#M214993</link>
      <description>&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue truefalseformat
    'True', '1' = 1
    'False', '0' = 0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 Nov 2020 10:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701980#M214993</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-11-27T10:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: Regular data import had a 1 time change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701982#M214994</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267404"&gt;@appletop&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the INFORMAT statement you permanently associated the user-defined informat &lt;FONT face="courier new,courier"&gt;truefalseformat&lt;/FONT&gt; to certain variables, i.e., the name of the informat is contained in the metadata of the dataset and causes problems if it's not found in the available format catalogs (&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lesysoptsref&amp;amp;docsetTarget=p1fvn6rwmpf1njn1whkud1hmsc97.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;FMTSEARCH= system option&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To avoid these problems, you should have used the informat specification &lt;EM&gt;only in the INPUT statement&lt;/EM&gt;, e.g.,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input aaa :$5. bbb :truefalseformat.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;for list input. I virtually never use the INFORMAT statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To remove the (mostly) unnecessary informat from a variable like &lt;FONT face="courier new,courier"&gt;bbb&lt;/FONT&gt; in the existing dataset, you can use PROC DATASETS:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc datasets lib=work nolist;
modify mydata;
informat bbb;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I typically use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat _all_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in the PROC DATASETS step to remove &lt;EM&gt;all&lt;/EM&gt; informats.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 10:35:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/701982#M214994</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-11-27T10:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regular data import had a 1 time change</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/702043#M215012</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
  invalue truefalseformat
    'True', '1' = 1
    'False', '0' = 0;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;
&lt;P&gt;My version for such looks more like&lt;/P&gt;
&lt;PRE&gt;proc format;
  invalue truefalseformat (upcase)
    'TRUE','T','Y','YES', '1' = 1
    'FALSE','F','N','NO', '0' = 0&lt;BR /&gt;    ' '=.&lt;BR /&gt;    other =_error_&lt;BR /&gt;   ;
run;&lt;/PRE&gt;
&lt;P&gt;The upcase helps with poor manual data entry where you get mixed T,t,F,f, fALSE, FalSE and so on. The explicit blank for missing allow use of Other to capture the really stupid data entries, like "?", by throwing invalid data messages to the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 15:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Regular-data-import-had-a-1-time-change/m-p/702043#M215012</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-27T15:07:23Z</dc:date>
    </item>
  </channel>
</rss>

