<?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 Cobol in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851010#M336321</link>
    <description>&lt;P&gt;So it looks like you are using UTF-8 encoding in your SAS session because it used three bytes to display that character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that really doesn't help much with understanding what your actual question is.&lt;/P&gt;
&lt;P&gt;Did the original programmer really type that strange character into the CODE?&lt;/P&gt;
&lt;P&gt;Or are just not explaining that you are trying to read (or perhaps write) from some file instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading from a file then you can use the $HEX format to display the codes for a line of the file.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.dat' obs=3 truncover;
  input string $char100.;
  put string $hex.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use the LIST statement and it will display the hex codes for any line that includes no printable characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.dat' obs=3 truncover;
  input ;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The number&amp;nbsp;20,200,903 you mentioned is NOT a date.&amp;nbsp; SAS dates are stored as the number of days since 1960 so a number that large would be in the year 57,267 if treated as a date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you want to convert that number to a four byte integer you could use PIB4. format or the S370FPIB4. format.&amp;nbsp; Depending on whether you want little endian or big endian numbers.&amp;nbsp; You can reverse the process using the same named informats.&lt;/P&gt;
&lt;PRE&gt;1860  data test;
1861    number=20200903;
1862    str1=put(number,pib4.);
1863    str2=put(number,S370Fpib4.);
1864    put  str1=$hex. / str2=$hex.;
1865    number1 = input(str1,pib4.);
1866    number2 = input(str2,s370fpib4.);
1867    put (number:) (=comma15./);
1868  run;

str1=C73D3401
str2=01343DC7
number=20,200,903
number1=20,200,903
number2=20,200,903
&lt;/PRE&gt;</description>
    <pubDate>Fri, 23 Dec 2022 21:45:44 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-12-23T21:45:44Z</dc:date>
    <item>
      <title>Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850879#M336255</link>
      <description>&lt;P&gt;Good evening community.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a program on 9.3 (AIX) that generates the following value for COBOL 4=▒ when applying the IB4 format. At value date 20200903.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The same program in SAS 9.4 (LINUX) generates the following value 4=Ç&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What format can I apply to obtain the same value (4=▒)?.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 00:40:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850879#M336255</guid>
      <dc:creator>SAS_LuisBolivar</dc:creator>
      <dc:date>2022-12-23T00:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850897#M336266</link>
      <description>&lt;P&gt;I cannot make sense of what your question is.&amp;nbsp; What is COBOL in this case?&amp;nbsp; Are you talking about the programming language COBOL?&amp;nbsp; Or is that the name of some character variable in your dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You seem to have pasted some types on non-ASCII characters into your question.&amp;nbsp; Where did you get those characters?&amp;nbsp; Are they in a file on your computer?&amp;nbsp; Can you examine the file with a program that can display the actual hexadecimal codes for the characters?&amp;nbsp; For example when I copy that character you posted that looks like a capital letter C with a tail into a SAS session running with LATIN1 encoding it looks like the character 'C7'x.&lt;/P&gt;
&lt;PRE&gt;1283   data _null_;
1284    x = ' 4=Ç' ;
1285    put x= $quote. / x= $hex.;
1286  run;

x=" 4=Ç"
x=20343DC7
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what do these character strings have to do with the number&amp;nbsp;&lt;SPAN&gt;20,200,903 that you also showed?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 04:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850897#M336266</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-23T04:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850933#M336281</link>
      <description>&lt;P&gt;I don't really understand what you're asking for but one comment: How a value prints will depend on your environment. If you want to verify if the actual value is the same or different when running a process in different environment then look at the HEX or Binary representation of the value and not how it prints. SAS provides formats for printing values in their Hex or Binary representation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 11:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/850933#M336281</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-12-23T11:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851006#M336317</link>
      <description>Greetings.&lt;BR /&gt;&lt;BR /&gt;If it is the Cobol programming language.&lt;BR /&gt;&lt;BR /&gt;There is a sas code that creates a .dat file, this program comes from SAS 9.3 (AIX) and the client migrated to SAS 9.4 (Linux).&lt;BR /&gt;&lt;BR /&gt;On AIX the value shown in the .dat file is 4=▒&lt;BR /&gt;&lt;BR /&gt;On linux the value displayed in the .dat file is 4=Ç&lt;BR /&gt;&lt;BR /&gt;Simulate your sas program:&lt;BR /&gt;&lt;BR /&gt;27         &lt;BR /&gt;28         data _null_;&lt;BR /&gt;29             x = '4=▒' ;&lt;BR /&gt;30             put x= $quote. / x= $hex.;&lt;BR /&gt;31         run;&lt;BR /&gt;&lt;BR /&gt;x="4=▒"&lt;BR /&gt;x=343DE29692&lt;BR /&gt;&lt;BR /&gt;Thank</description>
      <pubDate>Fri, 23 Dec 2022 20:52:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851006#M336317</guid>
      <dc:creator>SAS_LuisBolivar</dc:creator>
      <dc:date>2022-12-23T20:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851007#M336318</link>
      <description>&lt;P&gt;The POWER architecture is big-endian, Intel is little-endian. The IB format stores numbers in the native format of the processor.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 21:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851007#M336318</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-12-23T21:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: Format Cobol</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851010#M336321</link>
      <description>&lt;P&gt;So it looks like you are using UTF-8 encoding in your SAS session because it used three bytes to display that character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that really doesn't help much with understanding what your actual question is.&lt;/P&gt;
&lt;P&gt;Did the original programmer really type that strange character into the CODE?&lt;/P&gt;
&lt;P&gt;Or are just not explaining that you are trying to read (or perhaps write) from some file instead?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading from a file then you can use the $HEX format to display the codes for a line of the file.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.dat' obs=3 truncover;
  input string $char100.;
  put string $hex.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or use the LIST statement and it will display the hex codes for any line that includes no printable characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.dat' obs=3 truncover;
  input ;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The number&amp;nbsp;20,200,903 you mentioned is NOT a date.&amp;nbsp; SAS dates are stored as the number of days since 1960 so a number that large would be in the year 57,267 if treated as a date value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if you want to convert that number to a four byte integer you could use PIB4. format or the S370FPIB4. format.&amp;nbsp; Depending on whether you want little endian or big endian numbers.&amp;nbsp; You can reverse the process using the same named informats.&lt;/P&gt;
&lt;PRE&gt;1860  data test;
1861    number=20200903;
1862    str1=put(number,pib4.);
1863    str2=put(number,S370Fpib4.);
1864    put  str1=$hex. / str2=$hex.;
1865    number1 = input(str1,pib4.);
1866    number2 = input(str2,s370fpib4.);
1867    put (number:) (=comma15./);
1868  run;

str1=C73D3401
str2=01343DC7
number=20,200,903
number1=20,200,903
number2=20,200,903
&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Dec 2022 21:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Format-Cobol/m-p/851010#M336321</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-12-23T21:45:44Z</dc:date>
    </item>
  </channel>
</rss>

