<?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: listing macro variable's values with prefix in a procedure in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334856#M75660</link>
    <description>Nice and consice. I like it!</description>
    <pubDate>Wed, 22 Feb 2017 08:28:31 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2017-02-22T08:28:31Z</dc:date>
    <item>
      <title>listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334847#M75655</link>
      <description>&lt;DIV class="post-text"&gt;&lt;P&gt;I have a macro variable:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;%let par = var1 var2 var3;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Now I want to use those values in a procedure like this&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;proc score data=test type=parms score=par out=score; var W_var1 W_var2 W_var3; run;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;For example, if var1=age then I want to list W_age in the var statement. I tried &lt;CODE&gt;var W_&amp;amp;par;&lt;/CODE&gt; but it doesn't work. Can anyone help me with a simple solution here? Thanks a bunch!!&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 22 Feb 2017 07:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334847#M75655</guid>
      <dc:creator>ShinCrayons</dc:creator>
      <dc:date>2017-02-22T07:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334850#M75657</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code W_&amp;amp;par would merely give you "W_var1 var var". You must parse out the macro variable par and prefix the W_ for each word in the value. Based upon a sample code in the SAS usage notes, this woujld be a good start:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
%macro test(string);
  %let word_cnt=%sysfunc(countw(%superq(string)));   /* Count # words */
proc score data=test type=parms score=par out=score;
var
  %do i = 1 %to &amp;amp;word_cnt;
    %let var&amp;amp;i=%qscan(%superq(string),&amp;amp;i,%str( ));   /* get i'th word  */
    W_&amp;amp;&amp;amp;var&amp;amp;i   /* add prefix */
  %end;
; run;
%mend test;

%let par = var1 var2 var3;
%test (&amp;amp;par);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 07:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334850#M75657</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2017-02-22T07:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334853#M75659</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let par = var1 var2 var3;
%let score=%sysfunc(prxchange(s/(\w+)/W_$1/,-1,&amp;amp;par));

%put &amp;amp;score ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 08:22:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334853#M75659</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-22T08:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334856#M75660</link>
      <description>Nice and consice. I like it!</description>
      <pubDate>Wed, 22 Feb 2017 08:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334856#M75660</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2017-02-22T08:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334868#M75663</link>
      <description>&lt;P&gt;what if I want to add '1' at the end of every values of &amp;amp;par? I'm confusing about how prxchange function work.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 10:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334868#M75663</guid>
      <dc:creator>ShinCrayons</dc:creator>
      <dc:date>2017-02-22T10:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: listing macro variable's values with prefix in a procedure</title>
      <link>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334893#M75680</link>
      <description>&lt;PRE&gt;

%let par = var1 var2 var3;
%let score=%sysfunc(prxchange(s/(\w+)/W_\11/,-1,&amp;amp;par));

%put &amp;amp;score ;

&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Feb 2017 11:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/listing-macro-variable-s-values-with-prefix-in-a-procedure/m-p/334893#M75680</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-22T11:42:03Z</dc:date>
    </item>
  </channel>
</rss>

