<?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 can i read a number with Least significant byte first in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499818#M229</link>
    <description>&lt;P&gt;I asked which decimal number you want to get out of 520400E5.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Sep 2018 09:20:23 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-09-28T09:20:23Z</dc:date>
    <item>
      <title>How can i read a number with Least significant byte first  ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499806#M222</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to read a dbf (version 7) file from sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a result, i started to create a program .&lt;/P&gt;&lt;P&gt;However, i need to read three fields with LSB in file header like this :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;4-7 32-bit number Number of records in the table. (Least significant byte first.)&lt;BR /&gt;8-9 16-bit number Number of bytes in the header. (Least significant byte first.)&lt;BR /&gt;10-11 16-bit number Number of bytes in the record. (Least significant byte first.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i do ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%Let NBRECORD=520400E5;

%let nbrecord=%sysfunc(inputn(&amp;amp;nbrecord.,hex.));

/* with lsb */
%let nbrecord=%sysfunc(inputn(&amp;amp;nbrecord.,????.));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 08:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499806#M222</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T08:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first  ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499808#M223</link>
      <description>&lt;P&gt;SAS provides direct access with SAS/ACCESS to PC Files. Do you have that licensed?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 08:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499808#M223</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T08:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first  ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499810#M224</link>
      <description>&lt;P&gt;PS which number would you expect to get from&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token number"&gt;520400E5&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;? &lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 08:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499810#M224</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T08:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first  ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499811#M225</link>
      <description>&lt;P&gt;Yes i have&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 08:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499811#M225</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T08:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first  ?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499812#M226</link>
      <description>&lt;P&gt;Then use proc import with dbms=dbf.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 08:55:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499812#M226</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T08:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499813#M227</link>
      <description>Unfortunately i can't .&lt;BR /&gt;&lt;BR /&gt;The dbf file is Dbase version 7 !&lt;BR /&gt;&lt;BR /&gt;The number (32bits) i want to read is 520400E5 (hex) .&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Sep 2018 09:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499813#M227</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T09:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499818#M229</link>
      <description>&lt;P&gt;I asked which decimal number you want to get out of 520400E5.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 09:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499818#M229</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T09:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499819#M230</link>
      <description>&lt;P&gt;Sorry, this one : 283333 (the number of rows or records table).&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 09:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499819#M230</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T09:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499826#M233</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/75973"&gt;@cperichon_macif&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Sorry, this one : 283333 (the number of rows or records table).&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That doesn't match at all. The hex representation of this number is 000452c5. With no method of reordering can I get the hex you posted.&lt;/P&gt;
&lt;P&gt;Could you please post a hex dump of the first 16 bytes of the file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in SAS, the first position in a string is 1, not 0. So if you read the first 16 bytes into a string, the number of records is substr(string,5,4)&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 10:24:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499826#M233</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T10:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499829#M235</link>
      <description>&lt;P&gt;I see. You started 1 position too late. Look for hex C5520400. Once you convert that with informat ibr4., you'll get your count.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 10:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499829#M235</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T10:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499872#M238</link>
      <description>&lt;P&gt;thank you so much, you were right !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you agree with this code , if i only want to read the first 12 bytes ?.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data header;
	infile dbf recfm=n;
	informat version $char1.;
	informat year $char1.;
	informat month $char1.;
	informat day $char1.;
	format version $hex.;
	format year $hex.;
	format month $hex.;
	format day $hex.;
	input version 
		@2 year   
		@3 month 
		@4 day 
		@5 nbrecord ibr4. 
		@9 nbbyteh ibr2. 
		@11 nbbyter ibr2.  

	;

	if _n_=2 then
		stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here is the link of dbf file structure : &lt;A href="http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm" target="_blank"&gt;http://www.dbase.com/KnowledgeBase/int/db7_file_fmt.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My goal is to read the file, create a sas table and apply some updates or add new records .&lt;/P&gt;&lt;P&gt;Then, i put down the sas table in the dbf file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 12:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499872#M238</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T12:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499881#M240</link>
      <description>&lt;P&gt;Looks right to me. Personally, I'd use formatted input all the way throgh, and convert to a SAS date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data header;
infile dbf recfm=n;
input
  version $char1.
  _year $char1.
  _month $char1.
  _day $char1.
  nbrecord ibr4. 
  nbbyteh ibr2. 
  nbbyter ibr2.  
;
format
  version $hex2.
  date yymmddd10.
;
date = input(put(_year,$hex2.) !! put(_month,$hex2.) !! put(day,$hex2.),yymmdd6.);
output;
stop;
drop _year _month _day;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Take care that a suitable yearcutoff= option has been set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see no mention in the SAS documentation about dBase versions being supported or not. What happens when you try to use proc import with dbms=dbf?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 13:05:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499881#M240</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T13:05:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499888#M241</link>
      <description>&lt;P&gt;Here is the log when i use the proc import :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;24         proc import dbms=dbf file="&amp;amp;racjob.\macif.dbf" replace out=macif;
24       !                                                                   run;

NOTE: Imported 1 columns and 283333 rows of data from the dBase table file.
NOTE: WORK.MACIF data set was successfully created.
NOTE: PROCEDURE IMPORT used (Total process time):
      real time           13.37 seconds
      cpu time            2.14 seconds&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The number of rows is good but only one column with no data !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nom&amp;nbsp;&amp;nbsp; &amp;nbsp;Type&amp;nbsp;&amp;nbsp; &amp;nbsp;Longueur&amp;nbsp;&amp;nbsp; &amp;nbsp;Format&amp;nbsp;&amp;nbsp; &amp;nbsp;Informat&amp;nbsp;&amp;nbsp; &amp;nbsp;Libellé&lt;BR /&gt;DBWINUS0&amp;nbsp;&amp;nbsp; &amp;nbsp;Alphanumérique&amp;nbsp;&amp;nbsp; &amp;nbsp;0&amp;nbsp;&amp;nbsp; &amp;nbsp;$.&amp;nbsp;&amp;nbsp; &amp;nbsp;$.&amp;nbsp;&amp;nbsp; &amp;nbsp;DBWINUS0&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 13:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499888#M241</guid>
      <dc:creator>cperichon_macif</dc:creator>
      <dc:date>2018-09-28T13:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can i read a number with Least significant byte first</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499899#M243</link>
      <description>&lt;P&gt;Nice. One character column of length zero. So there's something that breaks SAS's dbf engine.&lt;/P&gt;
&lt;P&gt;I'd put it to SAS technical support, just to see what they have to say.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you try to use dbfExport to create a csv file, and read that with a data step? The downside would be that you need to know the structure beforehand.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Sep 2018 13:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-i-read-a-number-with-Least-significant-byte-first/m-p/499899#M243</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-09-28T13:44:03Z</dc:date>
    </item>
  </channel>
</rss>

