<?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 !! With subst function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71858#M20769</link>
    <description>Could anyone briefly explain what the !! does with the subst function?</description>
    <pubDate>Wed, 16 Sep 2009 17:56:16 GMT</pubDate>
    <dc:creator>Stephanie55901</dc:creator>
    <dc:date>2009-09-16T17:56:16Z</dc:date>
    <item>
      <title>!! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71858#M20769</link>
      <description>Could anyone briefly explain what the !! does with the subst function?</description>
      <pubDate>Wed, 16 Sep 2009 17:56:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71858#M20769</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T17:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71859#M20770</link>
      <description>Do you mean substr instea of subst? &lt;BR /&gt;
&lt;BR /&gt;
!! is the concatenation operator, so an expression of the form&lt;BR /&gt;
&lt;BR /&gt;
charvar3 = charvar1 !! substr(charvar2, 1, 1);&lt;BR /&gt;
&lt;BR /&gt;
concatenates the leftmost character from charvar2 to the right end of charvar1 to produce charvar3 (assuming charvar3 is long enough to hold the result of the concatenation).&lt;BR /&gt;
&lt;BR /&gt;
See &lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000780367.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000780367.htm&lt;/A&gt;.</description>
      <pubDate>Wed, 16 Sep 2009 18:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71859#M20770</guid>
      <dc:creator>Tim_SAS</dc:creator>
      <dc:date>2009-09-16T18:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71860#M20771</link>
      <description>The key point made by Tim@SAS is that the charvar1 variable is not going to be trimmed of any trailing blanks -- if this behavior is undesired with your programming needs, you may want to consider also using either the CATT function (new with SAS 9) or using TRIM(charvar1) or possibly if you expect some particular length using the PUT(charvar1,&lt;FORMAT_WITH_LENGTH&gt;) as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/FORMAT_WITH_LENGTH&gt;</description>
      <pubDate>Wed, 16 Sep 2009 18:40:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71860#M20771</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-16T18:40:13Z</dc:date>
    </item>
    <item>
      <title>Re: !! With substr function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71861#M20772</link>
      <description>thanks.  I think i usually use the || for this.  I am studying for the BASE certification exam, and there was a question on the practice exam , there was a question:&lt;BR /&gt;
&lt;BR /&gt;
data hello;&lt;BR /&gt;
phonenumber=3125551212;&lt;BR /&gt;
code='(' !! substr(Phonenumber,1,3) !! ')';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
i totally understand what the substr function does, just stuck sometimes on what is trimmed &lt;BR /&gt;
&lt;BR /&gt;
the answer is that code= (  3)</description>
      <pubDate>Wed, 16 Sep 2009 18:59:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71861#M20772</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T18:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71862#M20773</link>
      <description>sorry that is 2 space before the 3</description>
      <pubDate>Wed, 16 Sep 2009 19:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71862#M20773</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T19:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71863#M20774</link>
      <description>What is the answer?  Not seeing the question but seeing the intended SAS code, it appears to me that someone is attempting to extract the area code an enclose it in parentheses to create SAS variable "code", right?&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 16 Sep 2009 19:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71863#M20774</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-09-16T19:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71864#M20775</link>
      <description>the answer is (   3)  [2 spaces in front of the 3]</description>
      <pubDate>Wed, 16 Sep 2009 20:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71864#M20775</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T20:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: !! With substr function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71865#M20776</link>
      <description>You problems are caused by the data type, numeric, for PHONENUMBER and the conversion to character using BEST12. format.&lt;BR /&gt;
&lt;BR /&gt;
How about a different method.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
9    proc format;&lt;BR /&gt;
10      picture phone other=' 999)999-9999' (prefix='(');&lt;BR /&gt;
NOTE: Format PHONE has been output.&lt;BR /&gt;
11      run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: PROCEDURE FORMAT used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
12   data _null_;&lt;BR /&gt;
13      phonenumber=3125551212;&lt;BR /&gt;
14      *code='(' !! substr(Phonenumber,1,3) !! ')';&lt;BR /&gt;
15      put (phone:) (=phone.);&lt;BR /&gt;
16      run;&lt;BR /&gt;
&lt;BR /&gt;
phonenumber=(312)555-1212&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 16 Sep 2009 21:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71865#M20776</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-09-16T21:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: !! With subst function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71866#M20777</link>
      <description>thanks, that helps alot to know that when SAS converts automatically to character, it converts to the best12. and right justifies, since the phone number is currently 10 digits, right justifying puts 2 trailing blanks in front and hence the 2 extra spaces.&lt;BR /&gt;
&lt;BR /&gt;
makes sense!</description>
      <pubDate>Wed, 16 Sep 2009 21:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/With-subst-function/m-p/71866#M20777</guid>
      <dc:creator>Stephanie55901</dc:creator>
      <dc:date>2009-09-16T21:55:19Z</dc:date>
    </item>
  </channel>
</rss>

