<?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: New variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58054#M12593</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;%&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- comma separated quoted values --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; csqv(key1,key2,key3,key4,key5,key6,key7,key8,key9);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i k;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;9&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; k = &amp;amp;&amp;amp;key&amp;amp;i;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;k= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%goto&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; cont;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;i&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;,;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(quote(&amp;amp;k))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="font-size: 9pt; font-family: Courier New;"&gt;cont&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; csqv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; ***%csqv(abc, def, hij)***;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;%&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;***"abc","def","hij"***&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;--*;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Apr 2011 19:00:45 GMT</pubDate>
    <dc:creator>chang_y_chung_hotmail_com</dc:creator>
    <dc:date>2011-04-27T19:00:45Z</dc:date>
    <item>
      <title>New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58049#M12588</link>
      <description>%MACRO OUTPUT(DSN,MARKET,GROUP1,GROUP2,GROUP3);       &lt;BR /&gt;
                                                             &lt;BR /&gt;
%DO I=1 %TO 3;                                               &lt;BR /&gt;
   %put GROUP= &amp;amp;&amp;amp;GROUP&amp;amp;I;                                    &lt;BR /&gt;
   %IF %NRQUOTE(&amp;amp;&amp;amp;GROUP&amp;amp;I)= %THEN %DO;                       &lt;BR /&gt;
      %LET VGROUP&amp;amp;I = ;                                      &lt;BR /&gt;
   %END;                                                     &lt;BR /&gt;
   %ELSE %DO;                                                &lt;BR /&gt;
      %LET VGROUP&amp;amp;I = "&amp;amp;&amp;amp;GROUP&amp;amp;I"N;                          &lt;BR /&gt;
   %END;                                                     &lt;BR /&gt;
   %put VGROUP= &amp;amp;&amp;amp;VGROUP&amp;amp;I;  &lt;BR /&gt;
&lt;BR /&gt;
%END;    &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%mend output; &lt;BR /&gt;
%OUTPUT(ANTIF,ANTI-FUNGAL          &lt;BR /&gt;
       ,ABC,DE F,HIJ);                 &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
How to create another macro variable name which resolves as follows:&lt;BR /&gt;
  'ABC,'DEF',HIJ'&lt;BR /&gt;
i.e &lt;BR /&gt;
name resolves to  'ABC,'DEF',HIJ'</description>
      <pubDate>Wed, 27 Apr 2011 15:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58049#M12588</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-04-27T15:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58050#M12589</link>
      <description>Hello SASPhile,&lt;BR /&gt;
&lt;BR /&gt;
You wrote: How to create another macro variable name which resolves as follows:&lt;BR /&gt;
'ABC,'DEF',HIJ' i.e name resolves to 'ABC,'DEF',HIJ' &lt;BR /&gt;
&lt;BR /&gt;
%let New='ABC,'DEF',HIJ';&lt;BR /&gt;
&lt;BR /&gt;
Is this what you need?&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 27 Apr 2011 18:01:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58050#M12589</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-04-27T18:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58051#M12590</link>
      <description>Yes.&lt;BR /&gt;
But macro variable 'NEW' are the postional parameters. They may change whenever the user passes a new value.&lt;BR /&gt;
So it should be dynamic.</description>
      <pubDate>Wed, 27 Apr 2011 18:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58051#M12590</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-04-27T18:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58052#M12591</link>
      <description>How about this within your macro:&lt;BR /&gt;
&lt;BR /&gt;
%let new="&amp;amp;GROUP1.","&amp;amp;GROUP2.","&amp;amp;GROUP3.";?</description>
      <pubDate>Wed, 27 Apr 2011 18:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58052#M12591</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-04-27T18:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58053#M12592</link>
      <description>The reason to create %let name is to use it in subsetting the dataset in the next step.&lt;BR /&gt;
i.e  where condition  where rolrod in (&amp;amp;name);&lt;BR /&gt;
&lt;BR /&gt;
The problem with that is:&lt;BR /&gt;
&lt;BR /&gt;
there could be group1 to group9 values.but sometimes user passes only 6 or 5 or 3 values .&lt;BR /&gt;
so in the %let name statement if we define from group1 to group9 &lt;BR /&gt;
&lt;BR /&gt;
and only three values are passed&lt;BR /&gt;
the macro varible will have missing values in the end like this&lt;BR /&gt;
&lt;BR /&gt;
%let name= 'ABC','DEF',HIJ',,,,,, ;</description>
      <pubDate>Wed, 27 Apr 2011 18:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58053#M12592</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-04-27T18:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58054#M12593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;%&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- comma separated quoted values --*;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; csqv(key1,key2,key3,key4,key5,key6,key7,key8,key9);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i k;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;9&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; k = &amp;amp;&amp;amp;key&amp;amp;i;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;k= &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%goto&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; cont;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%if&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &amp;amp;i&amp;gt;&lt;/SPAN&gt;&lt;STRONG style="color: #008080; font-size: 9pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%then&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;,;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;(quote(&amp;amp;k))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM style="font-size: 9pt; font-family: Courier New;"&gt;cont&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG style="color: #000080; font-size: 9pt; font-family: Courier New;"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; csqv;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff; font-family: Courier New; font-size: 9pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt; ***%csqv(abc, def, hij)***;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: Courier New; font-size: 9pt;"&gt;%&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;*-- on log&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;***"abc","def","hij"***&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008000; font-family: Courier New; font-size: 9pt;"&gt;--*;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2011 19:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58054#M12593</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-04-27T19:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58055#M12594</link>
      <description>%cont is not defined!?</description>
      <pubDate>Wed, 27 Apr 2011 19:05:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58055#M12594</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-04-27T19:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58056#M12595</link>
      <description>How about:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
%MACRO OUTPUT(DSN,MARKET,GROUP1,GROUP2,GROUP3); &lt;BR /&gt;
%let name=;&lt;BR /&gt;
%let group1=%sysfunc(compress(&amp;amp;group1));&lt;BR /&gt;
%let group2=%sysfunc(compress(&amp;amp;group2));&lt;BR /&gt;
%let group3=%sysfunc(compress(&amp;amp;group3));&lt;BR /&gt;
&lt;BR /&gt;
%DO I=1 %TO 3; &lt;BR /&gt;
  %let name=&amp;amp;name %str(%')&amp;amp;&amp;amp;group&amp;amp;i%str(%');&lt;BR /&gt;
%END;&lt;BR /&gt;
%let name=%sysfunc(translate(&amp;amp;name,%str(,),%str( )));&lt;BR /&gt;
%put name= &amp;amp;name;&lt;BR /&gt;
&lt;BR /&gt;
%mend output;&lt;BR /&gt;
%OUTPUT(ANTIF,ANTI-FUNGAL,ABC,DE F,HIJ)&lt;BR /&gt;
&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: Ksharp</description>
      <pubDate>Thu, 28 Apr 2011 03:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58056#M12595</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-28T03:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58057#M12596</link>
      <description>Hi SASPhile&lt;BR /&gt;
&lt;BR /&gt;
Is it eventually this you're after?&lt;BR /&gt;
&lt;BR /&gt;
%macro OUTPUT/parmbuff;&lt;BR /&gt;
   &lt;BR /&gt;
   %let dsn=%scan(%bquote(&amp;amp;syspbuff),1,%str(%(,%)));&lt;BR /&gt;
   %let MARKET=%scan(%bquote(&amp;amp;syspbuff),2,%str(,%)));&lt;BR /&gt;
&lt;BR /&gt;
   %put dsn   = &amp;amp;dsn;&lt;BR /&gt;
   %put market= &amp;amp;market;&lt;BR /&gt;
   &lt;BR /&gt;
   %let i=3;&lt;BR /&gt;
   %let name=;&lt;BR /&gt;
   %do %while(%scan(%bquote(&amp;amp;syspbuff),&amp;amp;i,%str(,%))) ne );&lt;BR /&gt;
      %let group&amp;amp;i =%scan(%bquote(&amp;amp;syspbuff),&amp;amp;i,%str(,%)));&lt;BR /&gt;
      %let vgroup&amp;amp;i="&amp;amp;&amp;amp;group&amp;amp;i"N;&lt;BR /&gt;
      %if &amp;amp;name eq %then %let name="&amp;amp;&amp;amp;group&amp;amp;i";&lt;BR /&gt;
      %else %let name=&amp;amp;name.,"&amp;amp;&amp;amp;group&amp;amp;i";&lt;BR /&gt;
 &lt;BR /&gt;
      %put group= &amp;amp;&amp;amp;GROUP&amp;amp;I; &lt;BR /&gt;
      %put VGROUP= &amp;amp;&amp;amp;VGROUP&amp;amp;I; &lt;BR /&gt;
&lt;BR /&gt;
      %let i=%eval(&amp;amp;i+1);&lt;BR /&gt;
   %end;&lt;BR /&gt;
&lt;BR /&gt;
   %put name= &amp;amp;name;&lt;BR /&gt;
&lt;BR /&gt;
%mend OUTPUT;&lt;BR /&gt;
&lt;BR /&gt;
%OUTPUT(ANTIF,ANTI-FUNGAL,ABC,DE F,HIJ) &lt;BR /&gt;
&lt;BR /&gt;
%OUTPUT(ANTIF,ANTI-FUNGAL,ABC,DE F,HIJ, xxxx, yy yy) &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick

Message was edited by: Patrick</description>
      <pubDate>Thu, 28 Apr 2011 11:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58057#M12596</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-04-28T11:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58058#M12597</link>
      <description>if one of the parameters is like this ABC/DEF?</description>
      <pubDate>Thu, 28 Apr 2011 15:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58058#M12597</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-04-28T15:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58059#M12598</link>
      <description>Hi SASPhile&lt;BR /&gt;
&lt;BR /&gt;
"if one of the parameters is like this ABC/DEF?"&lt;BR /&gt;
&lt;BR /&gt;
You're the one who knows best what strings could be passed - and probabely you need to play around a bit more with quoting and unquoting.&lt;BR /&gt;
&lt;BR /&gt;
For the case you've given using %qscan() instead of %scan() in the %do..%while loop does the trick:&lt;BR /&gt;
%do %while(%qscan(&amp;amp;syspbuff,&amp;amp;i,%str(,%))) ne );&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Fri, 29 Apr 2011 04:00:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58059#M12598</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2011-04-29T04:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58060#M12599</link>
      <description>Hi,&lt;BR /&gt;
How to insert a record?&lt;BR /&gt;
 when passing the parameters say ABC is not present in the dataset, we need to insert a record for ABC in the dataset.</description>
      <pubDate>Mon, 09 May 2011 19:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58060#M12599</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2011-05-09T19:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58061#M12600</link>
      <description>[pre]&lt;BR /&gt;
data class;&lt;BR /&gt;
 set sashelp.class;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
 insert into class&lt;BR /&gt;
  set name='ABC',age=10;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 10 May 2011 03:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/58061#M12600</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-05-10T03:37:57Z</dc:date>
    </item>
  </channel>
</rss>

