<?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: Concatenate multiple Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509897#M137141</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91059"&gt;@sanjay1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I am tryng to create a link variable by concotinating certain variables. But I am getting blank data.&lt;BR /&gt;Please suggest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my data.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Data test;&lt;BR /&gt;input number subject$ status$ EMAIL_$ 10.;&lt;BR /&gt;datalines;&lt;BR /&gt;123 abc yes khgkjh@123&lt;BR /&gt;246 bcv no jhhgjh@234&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*What I am trying*/&lt;BR /&gt;data test1;&lt;BR /&gt;set test;&lt;BR /&gt;link = "&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=&amp;quot;||strip(number)||" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl="||strip(number)||&lt;/A&gt;&lt;BR /&gt;%nrstr("&amp;amp;Q_subject=")||strip(subject)||%nrstr("&amp;amp;status=")||strip(yes)||%nrstr("&amp;amp;EMAIL_ADDRESS_=")||strip(EMAIL_);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output&lt;BR /&gt;&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Sanjay&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have I believe a terrible confusion between Macro functions, macro variable and dataset variables.&lt;/P&gt;
&lt;P&gt;Show us what the final result should be for the two lines in the example data.&lt;/P&gt;
&lt;P&gt;If you do not use " " around literal text&amp;nbsp;then the &amp;amp;Q do not try to resolve and %nrstr are not needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You code also fails because you reference a variable YES that does not exist. I believe you meant to use STATUS which sometimes has a value of yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am guessing that you want something similar to:&lt;/P&gt;
&lt;P&gt;The CATS function strips so there are no leading or&amp;nbsp;trailing spaces&lt;/P&gt;
&lt;PRE&gt;Data test;
   input number subject$ status$ EMAIL_$ 10.;
   length link $ 200.;
   link=cats('https://Company.abc.def.com/ghi/form/fghfjghkkkkl=',number,
'&amp;amp;Q_subject=',subject,'&amp;amp;status=',status,'&amp;amp;EMAIL_ADDRESS_=',EMAIL_);
datalines;
123 abc yes khgkjh@123
246 bcv no jhhgjh@234
run;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Nov 2018 14:57:38 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-11-02T14:57:38Z</dc:date>
    <item>
      <title>Concatenate multiple Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509884#M137131</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am tryng to create a link variable by concotinating certain variables. But I am getting blank data.&lt;BR /&gt;Please suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my data.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data test;&lt;BR /&gt;input number subject$ status$ EMAIL_$ 10.;&lt;BR /&gt;datalines;&lt;BR /&gt;123 abc yes khgkjh@123&lt;BR /&gt;246 bcv no jhhgjh@234&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*What I am trying*/&lt;BR /&gt;data test1;&lt;BR /&gt;set test;&lt;BR /&gt;link = "&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=&amp;quot;||strip(number)||" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl="||strip(number)||&lt;/A&gt;&lt;BR /&gt;%nrstr("&amp;amp;Q_subject=")||strip(subject)||%nrstr("&amp;amp;status=")||strip(yes)||%nrstr("&amp;amp;EMAIL_ADDRESS_=")||strip(EMAIL_);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output&lt;BR /&gt;&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sanjay&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:35:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509884#M137131</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2018-11-02T14:35:33Z</dc:date>
    </item>
    <item>
      <title>Concatination</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509888#M137139</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am tryng to create a link variable by concotinating certain variables. But I am getting blank data.&lt;BR /&gt;Please suggest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is my data&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data test;&lt;BR /&gt;input number subject$ status$ EMAIL_$ 10.;&lt;BR /&gt;datalines;&lt;BR /&gt;123 abc yes khgkjh@123&lt;BR /&gt;246 bcv no jhhgjh@234&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*What I am tryng*/&lt;/P&gt;&lt;P&gt;data test1;&lt;BR /&gt;set test;&lt;BR /&gt;link = "&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=&amp;quot;||strip(number)||" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl="||strip(number)||&lt;/A&gt;&lt;BR /&gt;%nrstr("&amp;amp;Q_subject=")||strip(subject)||%nrstr("&amp;amp;status=")||strip(yes)||%nrstr("&amp;amp;EMAIL_ADDRESS_=")||strip(EMAIL_);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Desired output&lt;BR /&gt;&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sanjay&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:45:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509888#M137139</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2018-11-02T14:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate multiple Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509891#M137136</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have written 'yes' instead of 'status'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using simple quotes to vaoid macrovariables resolution and the cats function, you can make the expression shorter :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test2;
set test;
link = cats("https://Company.abc.def.com/ghi/form/fghfjghkkkkl=",number,'&amp;amp;Q_subject=',subject,'&amp;amp;status=',status,'&amp;amp;EMAIL_ADDRESS_=',EMAIL_);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:49:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509891#M137136</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-11-02T14:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: Concatination</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509892#M137140</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91059"&gt;@sanjay1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I am tryng to create a link variable by concotinating certain variables. But I am getting blank data.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Blank data where? In test or in test1 or in your variables? Be specific.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To debug these things, it is extremely helpful if you actually look, with your own eyes, at the data sets created, using PROC PRINT or viewtable. Have you actually done that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are there errors in the SASLOG? Have you tried to figure these out? Can you show us the SASLOG?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also there is no reason to post your question twice. Please help us maintain some order in the forums by not posting questions&amp;nbsp;twice. &lt;STRIKE&gt;All replies ought to go into your other thread at&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509884#M137131" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509884#M137131&lt;/A&gt;&amp;nbsp;&lt;/STRIKE&gt;&amp;nbsp;UPDATE: The moderator has combined your two identical questions into one thread.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Nov 2018 15:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509892#M137140</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-02T15:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate multiple Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509897#M137141</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91059"&gt;@sanjay1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I am tryng to create a link variable by concotinating certain variables. But I am getting blank data.&lt;BR /&gt;Please suggest.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is my data.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Data test;&lt;BR /&gt;input number subject$ status$ EMAIL_$ 10.;&lt;BR /&gt;datalines;&lt;BR /&gt;123 abc yes khgkjh@123&lt;BR /&gt;246 bcv no jhhgjh@234&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*What I am trying*/&lt;BR /&gt;data test1;&lt;BR /&gt;set test;&lt;BR /&gt;link = "&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=&amp;quot;||strip(number)||" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl="||strip(number)||&lt;/A&gt;&lt;BR /&gt;%nrstr("&amp;amp;Q_subject=")||strip(subject)||%nrstr("&amp;amp;status=")||strip(yes)||%nrstr("&amp;amp;EMAIL_ADDRESS_=")||strip(EMAIL_);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Desired output&lt;BR /&gt;&lt;A href="https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123" target="_blank"&gt;https://Company.abc.def.com/ghi/form/fghfjghkkkkl=123&amp;amp;Q_subject=abc&amp;amp;status=yes&amp;amp;EMAIL_ADDRESS_=khgkjh@123&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Sanjay&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have I believe a terrible confusion between Macro functions, macro variable and dataset variables.&lt;/P&gt;
&lt;P&gt;Show us what the final result should be for the two lines in the example data.&lt;/P&gt;
&lt;P&gt;If you do not use " " around literal text&amp;nbsp;then the &amp;amp;Q do not try to resolve and %nrstr are not needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You code also fails because you reference a variable YES that does not exist. I believe you meant to use STATUS which sometimes has a value of yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am guessing that you want something similar to:&lt;/P&gt;
&lt;P&gt;The CATS function strips so there are no leading or&amp;nbsp;trailing spaces&lt;/P&gt;
&lt;PRE&gt;Data test;
   input number subject$ status$ EMAIL_$ 10.;
   length link $ 200.;
   link=cats('https://Company.abc.def.com/ghi/form/fghfjghkkkkl=',number,
'&amp;amp;Q_subject=',subject,'&amp;amp;status=',status,'&amp;amp;EMAIL_ADDRESS_=',EMAIL_);
datalines;
123 abc yes khgkjh@123
246 bcv no jhhgjh@234
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Nov 2018 14:57:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-multiple-Variables/m-p/509897#M137141</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-11-02T14:57:38Z</dc:date>
    </item>
  </channel>
</rss>

