<?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: SUBSTR in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753567#M237535</link>
    <description>&lt;P&gt;I get non-blank answers, so something in your code is wrong, or that's not the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
var1='20000000427276985 3020210406999912310000004476Z1000000Z100000100005100DR009500000000010137899589';
run;

PROC SQL;
CREATE TABLE outp AS
SELECT
SUBSTR (CAT(VAR1),1,1) AS ITEM,
SUBSTR (CAT(VAR1),2,35) AS acct_no,
SUBSTR (CAT(VAR1),37,2) AS acct_status
FROM have;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please show us (a portion of) the data, not as something you typed in, but following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the CAT function is not needed here.&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2021 17:46:25 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-07-12T17:46:25Z</dc:date>
    <item>
      <title>SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753560#M237531</link>
      <description>&lt;P&gt;Hi Expect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the following dataset: VAR&lt;/P&gt;&lt;P&gt;20000000427276985 3020210406999912310000004476Z1000000Z100000100005100DR009500000000010137899589&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And when i do a substr it return blank colums.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;CREATE TABLE MAP_COP_FILE AS&lt;BR /&gt;SELECT&lt;BR /&gt;SUBSTR (CAT(VAR1),1,1) AS ITEM,&lt;BR /&gt;SUBSTR (CAT(VAR1),2,35) AS 'External Account Number'N,&lt;BR /&gt;SUBSTR (CAT(VAR1),37,2) AS 'Account Status'N&lt;BR /&gt;FROM VBM.SAP_NOM&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VALLY_0-1626110594316.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61138i4081A1A8E46D44AF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VALLY_0-1626110594316.png" alt="VALLY_0-1626110594316.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;please assist&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 17:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753560#M237531</guid>
      <dc:creator>VALLY</dc:creator>
      <dc:date>2021-07-12T17:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753567#M237535</link>
      <description>&lt;P&gt;I get non-blank answers, so something in your code is wrong, or that's not the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
var1='20000000427276985 3020210406999912310000004476Z1000000Z100000100005100DR009500000000010137899589';
run;

PROC SQL;
CREATE TABLE outp AS
SELECT
SUBSTR (CAT(VAR1),1,1) AS ITEM,
SUBSTR (CAT(VAR1),2,35) AS acct_no,
SUBSTR (CAT(VAR1),37,2) AS acct_status
FROM have;
QUIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please show us (a portion of) the data, not as something you typed in, but following &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the CAT function is not needed here.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 17:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753567#M237535</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-12T17:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753587#M237545</link>
      <description>&lt;P&gt;Why are you calling the CAT function? CAT is intended to combine two or more variables. With a single variable it just adds overhead.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 19:07:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753587#M237545</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-12T19:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTR</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753606#M237550</link>
      <description>Show your log....</description>
      <pubDate>Mon, 12 Jul 2021 20:14:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTR/m-p/753606#M237550</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-12T20:14:29Z</dc:date>
    </item>
  </channel>
</rss>

