<?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: Concat Functions: Identifying variables in cat functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610907#M177995</link>
    <description>&lt;P&gt;I have no idea helping to solve the problem - maybe to early. But why do you store sas code in variable at all?&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 06:15:14 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-12-11T06:15:14Z</dc:date>
    <item>
      <title>Concat Functions: Identifying variables in cat functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610681#M177875</link>
      <description>&lt;P&gt;I have few dynamic conditions provided as below.As per the below example if i use cat function, we have lot of spaces in the variable QDT2 and STDY2,if catt/cats are used all the trailing and leading spaces will be removed respectively, but i want to retain spaces present before and after the text present in the quotes&amp;nbsp; . For example if catt/cats are used spaces will be removed&lt;STRONG&gt;(" (Study day ")&lt;/STRONG&gt; after day and also before parenthesis (study day. The ideal way is to use cat function or pipe symbol and to add strip to variables as below, but the challenge is to identifying variables to add strip function.How to identify and add strip only to the variables without affecting the text in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;data have;&lt;BR /&gt;length 2000;&lt;BR /&gt;have="if REF ='999' and not missing(DY2) then DATE = cat(QDT2 ,' (Study day ' ,STDY2 ,')' );";output;&lt;BR /&gt;have="if REF = 'UNKNOWN' then EVENT = '-';";output;&lt;BR /&gt;have="if EVENT = TERM then DECODE=TERM;";output;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;BR /&gt;data want;&lt;BR /&gt;want="if REF ='999' and not missing(DY2) then DATE = &lt;STRONG&gt;cat(strip(QDT2) ,' (Study day ' ,strip(STDY2) ,')' )&lt;/STRONG&gt;;";output;&lt;BR /&gt;want="if REF = 'UNKNOWN' then EVENT = '-';";output;&lt;BR /&gt;want="if EVENT = TERM then DECODE=&lt;STRONG&gt;strip(TERM)&lt;/STRONG&gt;;";output;&lt;BR /&gt;run ;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Dec 2019 11:59:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610681#M177875</guid>
      <dc:creator>keen_sas</dc:creator>
      <dc:date>2019-12-10T11:59:36Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Functions: Identifying variables in cat functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610907#M177995</link>
      <description>&lt;P&gt;I have no idea helping to solve the problem - maybe to early. But why do you store sas code in variable at all?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 06:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610907#M177995</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-12-11T06:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Functions: Identifying variables in cat functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610918#M178002</link>
      <description>&lt;P&gt;Could CATX(' ',&amp;lt;list of vars and strings&amp;gt;) eventually be the resolution you're after?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 08:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/610918#M178002</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-12-11T08:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Functions: Identifying variables in cat functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/611234#M178109</link>
      <description>&lt;P&gt;Even Catx also removes the leading and trailing blanks from the variable and also from the string or sub string as mentioned in the example. Reason to include the SAS code in variables is part of the automation , writing logical conditions in the excel sheet and it has to executed.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 08:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/611234#M178109</guid>
      <dc:creator>keen_sas</dc:creator>
      <dc:date>2019-12-12T08:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Functions: Identifying variables in cat functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/611240#M178113</link>
      <description>&lt;P&gt;The very first element in the CATX() function defines the delimiter string when concatenating strings. If you chose a blank there then yes, CATX() will first strip trailing and leading blanks from the source string/variable but then add a single blank between the strings it concatenates. That's often what's needed.&lt;/P&gt;
&lt;P&gt;If you need some combination of how things get concatenated then don't use a single function but a combination of functions (cat, cats, catx,strip) or even just the 'stringA'||'stringB'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really can get whatever you need by choosing the right combination.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 09:42:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concat-Functions-Identifying-variables-in-cat-functions/m-p/611240#M178113</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-12-12T09:42:05Z</dc:date>
    </item>
  </channel>
</rss>

