<?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 Question in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350833#M23107</link>
    <description>&lt;P&gt;This is a very basic topic, converting number to character and vice versa. &amp;nbsp;The put and input functions are respectively used:&lt;/P&gt;
&lt;PRE&gt;where substr(put(RESP_YR,best.),1,4)='&amp;amp;begyr.'&lt;/PRE&gt;
&lt;P&gt;Note the put() which puts the numeric resp_yr into the best. format.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Apr 2017 13:16:20 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-04-18T13:16:20Z</dc:date>
    <item>
      <title>substr Question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350831#M23106</link>
      <description>&lt;P&gt;Hello how would this column resp_yr be turned into a character value so that this substr can work?&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;Rida&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;&lt;P&gt;NOTE: %INCLUDE (level 1) ending.&lt;BR /&gt;394&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;395&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROC SQL;&lt;BR /&gt;396&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;CREATE TABLE rptlib.sum_responses_curryr AS&lt;BR /&gt;397&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;SELECT *&lt;BR /&gt;398&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;FROM outlib.sum_responses_all_yrly&lt;BR /&gt;399&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;WHERE SUBSTR(resp_yr,1,4) = '&amp;amp;begyr.'&lt;BR /&gt;400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp; QUIT;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 13:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350831#M23106</guid>
      <dc:creator>Rsadiq</dc:creator>
      <dc:date>2017-04-18T13:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: substr Question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350833#M23107</link>
      <description>&lt;P&gt;This is a very basic topic, converting number to character and vice versa. &amp;nbsp;The put and input functions are respectively used:&lt;/P&gt;
&lt;PRE&gt;where substr(put(RESP_YR,best.),1,4)='&amp;amp;begyr.'&lt;/PRE&gt;
&lt;P&gt;Note the put() which puts the numeric resp_yr into the best. format.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 13:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350833#M23107</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-18T13:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: substr Question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350834#M23108</link>
      <description>&lt;P&gt;So RESP_YR is a number.&lt;/P&gt;
&lt;P&gt;Assuming it is the YEAR (ie 2010 or 2017 for example).&lt;/P&gt;
&lt;P&gt;Assuming that BEG_YR also a four digit string that looks like a year.&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;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;WHERE resp_yr = &amp;amp;begyr&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Example.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input resp_yr @@ ;
cards ;
2010 2013 2014 2015 
;
%let begyr=2013;

data want ;
 set have ;
 where resp_yr = &amp;amp;begyr ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Apr 2017 13:18:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350834#M23108</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-18T13:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: substr Question</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350877#M23116</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/133811"&gt;@Rsadiq&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hello how would this column resp_yr be turned into a character value so that this substr can work?&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;Rida&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;
&lt;P&gt;NOTE: %INCLUDE (level 1) ending.&lt;BR /&gt;394&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;395&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROC SQL;&lt;BR /&gt;396&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;CREATE TABLE rptlib.sum_responses_curryr AS&lt;BR /&gt;397&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;SELECT *&lt;BR /&gt;398&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;FROM outlib.sum_responses_all_yrly&lt;BR /&gt;399&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;WHERE SUBSTR(resp_yr,1,4) = '&amp;amp;begyr.'&lt;BR /&gt;400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;ERROR: Function SUBSTR requires a character expression as argument 1.&lt;BR /&gt;NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.&lt;BR /&gt;400&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp; QUIT;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Also note that = '&amp;amp;begyr.' will not likely get what you want any way as with single quotes the value compared would be &amp;amp;begyr NOT the resolved value of the macro variable begyr. Use = "&amp;amp;begyr."&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what kind of values does the variable resp_yr take anyway? If they are numeric actual years (2017)&lt;/P&gt;
&lt;P&gt;then&lt;/P&gt;
&lt;P&gt;where resp_yr = &amp;amp;begyr. should work just fine.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Apr 2017 14:38:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/substr-Question/m-p/350877#M23116</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-04-18T14:38:21Z</dc:date>
    </item>
  </channel>
</rss>

