<?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 How to concatenate a numeric field to a parameter value in PROC SQL in Developers</title>
    <link>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3231#M1691</link>
    <description>In a stored process, in a PROC SQL statement, I want to concatenate a value to a numeric field, such as "001" || WOMBAT as ALPHAWOMBAT.&lt;BR /&gt;
&lt;BR /&gt;
Is this possible?  Or, does something have to be done to the numeric field prior to concatenation?  Does anyone have a small sample of what they did to be able to do a concatenation of this kind?</description>
    <pubDate>Fri, 25 May 2007 20:35:44 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-05-25T20:35:44Z</dc:date>
    <item>
      <title>How to concatenate a numeric field to a parameter value in PROC SQL</title>
      <link>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3231#M1691</link>
      <description>In a stored process, in a PROC SQL statement, I want to concatenate a value to a numeric field, such as "001" || WOMBAT as ALPHAWOMBAT.&lt;BR /&gt;
&lt;BR /&gt;
Is this possible?  Or, does something have to be done to the numeric field prior to concatenation?  Does anyone have a small sample of what they did to be able to do a concatenation of this kind?</description>
      <pubDate>Fri, 25 May 2007 20:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3231#M1691</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-05-25T20:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate a numeric field to a parameter value in PROC SQL</title>
      <link>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3232#M1692</link>
      <description>Hi! &lt;BR /&gt;
  Not entirely sure what you want to do since your subject says concat a numeric "field" to a parameter value but down in your explanation, you say you want to concat a value to a numeric field. &lt;BR /&gt;
 &lt;BR /&gt;
Let's say that I have a parameter called "parm" coming from the stored process and I want to concat a number to it. Try this code and see if this is what you were thinking of.&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let parm=WOMBAT;&lt;BR /&gt;
     &lt;BR /&gt;
proc sql;&lt;BR /&gt;
  create table work.testit as&lt;BR /&gt;
    select name, age, height,&lt;BR /&gt;
	       "001"||"&amp;amp;parm" as alphawombat&lt;BR /&gt;
	from sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
quit;&lt;BR /&gt;
     &lt;BR /&gt;
proc print  data=work.testit;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
it produces this (partial) output: [pre]&lt;BR /&gt;
  &lt;BR /&gt;
 Obs    Name       Age    Height    alphawombat&lt;BR /&gt;
   1    Alfred      14     69.0      001WOMBAT&lt;BR /&gt;
   2    Alice       13     56.5      001WOMBAT&lt;BR /&gt;
   3    Barbara     13     65.3      001WOMBAT&lt;BR /&gt;
   4    Carol       14     62.8      001WOMBAT&lt;BR /&gt;
   5    Henry       14     63.5      001WOMBAT&lt;BR /&gt;
   6    James       12     57.3      001WOMBAT&lt;BR /&gt;
[/pre]&lt;BR /&gt;
or did you mean that you wanted to concat a number from a parm to a second parm to make a new macro variable???? In which case, concatenation works a bit differently. Consider that I still have a parameter whose value is WOMBAT and I have another parameter whose value is 001:&lt;BR /&gt;
[pre]&lt;BR /&gt;
** here I concatenate them in %LET stmts.;&lt;BR /&gt;
** look in the LOG to see how they work;&lt;BR /&gt;
** submit them in an EG code node after you submit the above code;&lt;BR /&gt;
%let parm=WOMBAT;&lt;BR /&gt;
%let num = 001;&lt;BR /&gt;
%let macvar = &amp;amp;num&amp;amp;parm;&lt;BR /&gt;
%let macvar2 = &amp;amp;parm.&amp;amp;num;&lt;BR /&gt;
%put -------&amp;gt; concat macro vars;&lt;BR /&gt;
%put macvar = &amp;amp;macvar;&lt;BR /&gt;
%put macvar2 = &amp;amp;macvar2;&lt;BR /&gt;
        &lt;BR /&gt;
** now I want to use them in a where clause;&lt;BR /&gt;
** Must have quotes around them when their usage in the where stmt;&lt;BR /&gt;
** makes quotes necessary.;&lt;BR /&gt;
options symbolgen mprint;&lt;BR /&gt;
proc print data=testit;&lt;BR /&gt;
where alphawombat in ("&amp;amp;macvar", "&amp;amp;macvar2");&lt;BR /&gt;
run;&lt;BR /&gt;
   &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
MPRINT and SYMBOLGEN are very useful options because they can help you debug what the macro processor is doing with macro variables when they're referenced in your code.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sat, 26 May 2007 05:09:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3232#M1692</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-05-26T05:09:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate a numeric field to a parameter value in PROC SQL</title>
      <link>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3233#M1693</link>
      <description>Thanks for the info!  I'll put it to good use.</description>
      <pubDate>Fri, 01 Jun 2007 20:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/How-to-concatenate-a-numeric-field-to-a-parameter-value-in-PROC/m-p/3233#M1693</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-06-01T20:41:36Z</dc:date>
    </item>
  </channel>
</rss>

