<?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: Proc SQL Substring of a numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551644#M153288</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank you all experts and the&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sbmdt_dt_id&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2019&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;work, but would you please explain to me why I need to divided by 10000?&amp;nbsp; The column declared numeric 8 length&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you so much for the inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is simple mathematics at this point. You need it because you wanted to extract 2019 from a longer number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as I said, if this number is actually a date, then you need to convert it to a valid SAS date value, which will make your programming much much much much much much much much much much much much simpler.&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2019 11:05:40 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-04-17T11:05:40Z</dc:date>
    <item>
      <title>Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551525#M153241</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm new in SAS and I need include a substring on my query of a numeric and it's not work and I get this error message -&lt;/P&gt;&lt;P&gt;the table has column sbmdt_dt_id as numeric&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 118px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28734i45E346B2B9778879/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and my query is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;select count(a.receipt_number)&lt;BR /&gt;from EXISDRDM.application_cdim a&lt;BR /&gt;where substr(a.sbmtd_dt_id, z4.) = 2019;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;even using put(a.sbmtd_dt_id, z4.) = 2019&lt;/P&gt;&lt;P&gt;error: column sbmtd_dt_id could not be found in the table/view identified with the correlation name A.&lt;/P&gt;&lt;P&gt;error: numeric format Z in put function requres a numeric argument.&lt;/P&gt;&lt;P&gt;error: Expression usqing equals (=) has components that are of different data types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the column declared as numeric and how to I pull the 1st 4 numeric like '2019" and/or middle numeric like "9011" in where clause?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I query&lt;/P&gt;&lt;P&gt;select count(a.receipt_number)&lt;BR /&gt;from EXISDRDM.application_cdim a&lt;BR /&gt;where left(put(a.sbmtd_dt_id, 4.)) = '2019';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get zero count.&amp;nbsp; That's not right.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bach-Nga&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:43:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551525#M153241</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2019-04-16T19:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551531#M153242</link>
      <description>&lt;P&gt;try substrn for numeric variable.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:42:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551531#M153242</guid>
      <dc:creator>LNEW</dc:creator>
      <dc:date>2019-04-16T19:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551533#M153243</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm new in SAS and I need include a substring on my query of a numeric and it's not work and I get this error message -&lt;/P&gt;
&lt;P&gt;the table has column sbmdt_dt_id as numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the column declared as numeric and how to I pull the 1st 4 numeric like '2019" and/or middle numeric like "9011" in where clause?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Use math.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where floor(a.sbmdt_dt_id/10000) = 2019;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;If the column declared as numeric and how to I pull the 1st 4 numeric like '2019" and/or middle numeric like "9011" in where clause?&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want 9011 from this longer number&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where floor((a.sbmdt_dt_id-floor(a.sbmtdt_dt_id/100000))/10)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But really, if these are dates, then they should be converted to valid SAS date values,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sasdatevalue = input(put(a.sbmt_dt_id,8.),yymmdd8.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and then the whole problem is much easier:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where year(sasdatevalue)=2019

where month(sasdatevalue)=1

where date(sasdatevalue)=11&lt;/CODE&gt;&lt;/PRE&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551533#M153243</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-16T19:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551535#M153245</link>
      <description>&lt;P&gt;I'm not sure that SQL supports SUBSTR in any form.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other variables can do the trick.&amp;nbsp; For example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where int(date/1000) = 2019&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The middle part is harder, but might still use a combination of functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where mod( int(date/100) , 1000) = 1901&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:46:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551535#M153245</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-16T19:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551536#M153246</link>
      <description>&lt;P&gt;thank you for replying.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;tried that as where substrn(a.sbmtd_dt_id, z4.) = 2019 or with single quote around '2019'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error 22-322:syntax error, expecting one of the following: a name, *.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I use substrn(a.sbmtd_dt_id, 4.) = 2019, I don't see any result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bach-Nga&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551536#M153246</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2019-04-16T19:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551538#M153247</link>
      <description>&lt;P&gt;thank you all experts and the&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sbmdt_dt_id&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2019&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;work, but would you please explain to me why I need to divided by 10000?&amp;nbsp; The column declared numeric 8 length&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you so much for the inputs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;v/r,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bach-Nga&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 19:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551538#M153247</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2019-04-16T19:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551541#M153248</link>
      <description>&lt;P&gt;This should work. Since your date number has year, then month, then day numeric and date order are the same.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where sbmtd_dt_id between 20190101 and 20191231&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 22:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551541#M153248</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-04-16T22:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551568#M153257</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;- see my post above for simpler answer.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 22:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551568#M153257</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-04-16T22:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551572#M153260</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank you all experts and the&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sbmdt_dt_id&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2019&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;work, but would you please explain to me why I need to divided by 10000?&amp;nbsp; The column declared numeric 8 length&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you so much for the inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;v/r,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bach-Nga&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;"Length" defined for numeric variables is the number of bytes used for storage. The default is 8 bytes.&lt;/P&gt;
&lt;P&gt;data junk;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; y=123456789;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;will have both x and y with a "length" of 8.&lt;/P&gt;
&lt;P&gt;The number of bytes limits the range of values than can be stored.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 22:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551572#M153260</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-16T22:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551586#M153267</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank you all experts and the&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sbmdt_dt_id&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2019&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;work, but would you please explain to me why I need to divided by 10000?&amp;nbsp; The column declared numeric 8 length&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you so much for the inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;v/r,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bach-Nga&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The LENGTH of a variable is how many bytes it will take to store the variable.&amp;nbsp; Since all SAS number are 8 byte floating point numbers if you store it with fewer bytes you just lose some of the bits of precision off of the number.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o"&gt;https://documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="p1vdcf18fxwje0n1t3lujnrc0z97" class="xis-paragraph"&gt;The following table lists the largest integer that can be reliably stored by a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="ng-scope" data-gloss-modified="" data-gloss-item="1"&gt;&lt;A class="glossLink ng-scope" href="https://documentation.sas.com/" target="_blank"&gt;&lt;SPAN class="xis-glossTerm ng-scope" data-gloss-term="1"&gt;SAS variable&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the mainframe, UNIX, and Windows operating environments.&lt;/DIV&gt;
&lt;DIV id="p0jgv2h7c4lluon1i4ki0hqlznvs" class="xis-table"&gt;
&lt;TABLE class="tgroup"&gt;&lt;CAPTION class="xis-title"&gt;Largest Integer That Can Be Safely Stored in a Given Length&lt;/CAPTION&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH&gt;
&lt;DIV id="n0qwk4shq0729in1uma28apysmtq" class="xis-paraTableFirst"&gt;When Variable Length Equals ...&lt;/DIV&gt;
&lt;/TH&gt;
&lt;TH class="xis-horizontalRight"&gt;
&lt;DIV id="p0nh56ojor12run1ekve1d6tc28o" class="xis-paraTableFirst"&gt;Largest Integer&lt;/DIV&gt;
&lt;DIV id="n1ld5m8x4fc6f4n10yhsqp8iirrw" class="xis-paraTable"&gt;&lt;SPAN class="xis-nobr"&gt;z/OS&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/TH&gt;
&lt;TH class="xis-horizontalRight"&gt;
&lt;DIV id="p0gpgfxgzxb0uan13joucwhrggni" class="xis-paraTableFirst"&gt;Largest Integer&lt;/DIV&gt;
&lt;DIV id="p005k67asic3sun16gusqzqkqe8v" class="xis-paraTable"&gt;Windows/UNIX&lt;/DIV&gt;
&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="n17vxxx38psoaxn14k9de0p2tqk9" class="xis-paraTableFirst"&gt;2&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p17lc8d869fj15n1lsoqy94osvs7" class="xis-paraTableFirst"&gt;256&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p1ggrfpeeg9zxin1mxufmabfgfvy" class="xis-paraTableFirst"&gt;not applicable&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="p0syfrmtxvu07xn1jzayk3drqn3x" class="xis-paraTableFirst"&gt;3&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p00yzj3g7eo8qyn1bdsad86dvy97" class="xis-paraTableFirst"&gt;65,536&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n13x7swxk0158hn1t34hkm6fk7tq" class="xis-paraTableFirst"&gt;8,192&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="n07iyon2094htsn19s8kchep3zks" class="xis-paraTableFirst"&gt;4&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n1acuzuoljipxfn1m5g2z88g5ulo" class="xis-paraTableFirst"&gt;16,777,216&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p0qxtset0lt5xcn11jliqrs7tlnb" class="xis-paraTableFirst"&gt;2,097,152&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="n1p0rnjudfk4rxn1lwhli0jr2xec" class="xis-paraTableFirst"&gt;5&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p0gd6y9nyy7m70n10bzt5ap6keud" class="xis-paraTableFirst"&gt;4,294,967,296&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n187v6gtnjwkxfn1bg60t0k2e169" class="xis-paraTableFirst"&gt;536,870,912&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="n1u295g0y06z4wn1gpmnzgw7i7i8" class="xis-paraTableFirst"&gt;6&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n1te184zb13yxpn1je1hi452ajat" class="xis-paraTableFirst"&gt;1,099,511,627,776&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p0eugjc1efm8wbn1ama7vdu1onpm" class="xis-paraTableFirst"&gt;137,438,953,472&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="p00y9dkqnn92gnn1j1r664d86e0l" class="xis-paraTableFirst"&gt;7&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="p1us8qjqc3hd4yn15qqw3rc8pc5r" class="xis-paraTableFirst"&gt;281,474,946,710,656&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n1ixmxgf8rt2z3n1w35ww7irgk7f" class="xis-paraTableFirst"&gt;35,184,372,088,832&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;DIV id="n07j8jg68z1pujn1eaj6e9p6kirc" class="xis-paraTableFirst"&gt;8 (default)&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n1hht28dqr0cnln17rshr44qmr5i" class="xis-paraTableFirst"&gt;72,057,594,037,927,936&lt;/DIV&gt;
&lt;/TD&gt;
&lt;TD&gt;
&lt;DIV id="n14rv9qgabmcbwn1xl5vb617q7cb" class="xis-paraTableFirst"&gt;9,007,199,254,740,992&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 16 Apr 2019 23:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551586#M153267</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-16T23:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551588#M153269</link>
      <description>&lt;P&gt;If you want to treat a number as if it is a string then first convert the number into a string.&lt;/P&gt;
&lt;P&gt;So if all of your values are between less than 100,000,000 then you could use Z8. format to convert it with leading zeros.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;substr(put(a.sbmtd_dt_id,z8.),1,4)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the leading digits (that is ignore the leading zeros) even if the magnitude of the numbers vary then use the normal numberic format (also known as F format) and left align the result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;substr(put(a.sbmtd_dt_id,F32.-L),1,4)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2019 23:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551588#M153269</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-16T23:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551637#M153286</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would - as a start - solve this problem in your log, because as&amp;nbsp;long as it's there nothing will work. It is good practice to to correct errors in the order they appear in the log, because following errors are most often caused by the first.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;error: column sbmtd_dt_id could not be found in the table/view identified with the correlation name A.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then try this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;substr(put(variable,8.),1,4)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Apr 2019 10:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551637#M153286</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-04-17T10:13:45Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551644#M153288</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/270904"&gt;@pepevo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;thank you all experts and the&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;floor&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;a&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;sbmdt_dt_id&lt;SPAN class="token operator"&gt;/&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;10000&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;2019&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;work, but would you please explain to me why I need to divided by 10000?&amp;nbsp; The column declared numeric 8 length&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank you so much for the inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is simple mathematics at this point. You need it because you wanted to extract 2019 from a longer number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as I said, if this number is actually a date, then you need to convert it to a valid SAS date value, which will make your programming much much much much much much much much much much much much simpler.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 11:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551644#M153288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-04-17T11:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Substring of a numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551746#M153332</link>
      <description>&lt;P&gt;thank you all experts for all your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mr. ErikLund_Jensen,&amp;nbsp;&lt;/P&gt;&lt;P&gt;this syntax below is not working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token function"&gt;substr&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token keyword"&gt;put&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;variable&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;4&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;ERROR: Expression using different data types.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask if&amp;nbsp; how do I get the output for a day from sysdate in SAS.&amp;nbsp; In Oracle, I used&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="ia-splitter"&gt;&lt;DIV class=" aui-page-panel"&gt;&lt;DIV class="page view"&gt;&lt;DIV class="wiki-content"&gt;&lt;DIV class="table-wrap"&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;SELECT DISTINCT&amp;nbsp;a.APPLICATION_ID, a.CRTD_USER_ID, a.FRM_TYP_ID&lt;BR /&gt;FROM APPLICATION_CDIM a&lt;BR /&gt;WHERE (trunc(a.CRTD_LOAD_DTTM) = trunc(sysdate - 1) OR trunc(a.UPTD_LOAD_DTTM) = trunc(sysdate - 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;if I want to run the query in SAS, I don't find trunc(sysdate -1)&lt;/P&gt;&lt;P&gt;select&amp;nbsp;DISTINCT&amp;nbsp;a.APPLICATION_ID, a.CRTD_USER_ID, a.FRM_TYP_ID&lt;BR /&gt;FROM APPLICATION_CDIM a where weekday(a.updt_load_dttm) = 1; and get 0 row and not sure it's corrected to pull a day old from a column, updt_load_dttm (this column declared as timestamp in oracle and datetime27.6 in sas) and according from sas, I see the a tons of million rows upload today&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you sir and all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;v/r,&lt;/P&gt;&lt;P&gt;Bach-Nga&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2019 15:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-SQL-Substring-of-a-numeric-variable/m-p/551746#M153332</guid>
      <dc:creator>pepevo</dc:creator>
      <dc:date>2019-04-17T15:10:37Z</dc:date>
    </item>
  </channel>
</rss>

