<?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: Designate variable name with intermediate match in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297984#M62625</link>
    <description>&lt;P&gt;Hi,ballardw&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes,actually the way you showed is also good.&lt;/P&gt;&lt;P&gt;Thank you for your posting.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 12:10:58 GMT</pubDate>
    <dc:creator>t_ar_taat</dc:creator>
    <dc:date>2016-09-13T12:10:58Z</dc:date>
    <item>
      <title>Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297579#M62517</link>
      <description>&lt;P&gt;When specifying variable name,I'm looking for how to designate variables in the middle match for the variable name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _test;
 VAR_A_A=1;
 VAR_B_A=2;
 VAR_C_A=3;

 VAR_A_B=100;
 VAR_B_B=200;
 VAR_C_B=300;
 run;
 
 data _null_;
  set _test;
   Total_by_colon=sum(of VAR:);put "Total is " Total_by_colon;
  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;In this situation, I wanna sum "VAR_A_A" "VAR_B_A" VAR_C_A", which should be ending with answer 6(=1+2+3).&lt;/P&gt;&lt;P&gt;But we know,If we write&lt;BR /&gt;sum(of VAR:);&lt;BR /&gt;This ansiwer is 606(=1+2+3+100+200+300).&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4885i605D82F1794C4409/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="606.JPG" title="606.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From a different point of view, I want to use a regular expression when specifying vars. But it will not be.&lt;/P&gt;&lt;P&gt;I think there is a need to create a macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have the wisdom, thank you in advance.&lt;BR /&gt;Regards,t_ar_taat&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2016 04:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297579#M62517</guid>
      <dc:creator>t_ar_taat</dc:creator>
      <dc:date>2016-09-11T04:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297580#M62518</link>
      <description>&lt;P&gt;You can create a macro or use the VVALUEX logic and obtain the values.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2016 04:52:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297580#M62518</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-11T04:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297582#M62519</link>
      <description>&lt;PRE&gt;
Yeah. Make a macro variable to hold it.




data _test;
 VAR_A_A=1;
 VAR_B_A=2;
 VAR_C_A=3;

 VAR_A_B=100;
 VAR_B_B=200;
 VAR_C_B=300;
 run;
proc transpose data=_test(obs=0) out=temp;
var _all_;
run;
proc sql;
select _name_ into : list separated by ','
 from temp
  where upcase(_name_) like 'VAR~_%~_A' escape '~';
quit;
data _null_;
  set _test;
   Total_by_colon=sum(&amp;amp;list);put "Total is " Total_by_colon;
  run;


&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Sep 2016 06:35:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297582#M62519</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-11T06:35:22Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297586#M62522</link>
      <description>&lt;P&gt;Hi,Reeza&lt;/P&gt;&lt;P&gt;Thank you for giving me your knoledge very quickly.I'll try it.&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2016 08:53:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297586#M62522</guid>
      <dc:creator>t_ar_taat</dc:creator>
      <dc:date>2016-09-11T08:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297588#M62523</link>
      <description>&lt;P&gt;HI,&lt;SPAN&gt;Xia&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;I confirmed your codes work well,in short,answer is actually "6".&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/4886iD82A04B2FF19D108/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="6.jpg" title="6.jpg" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 11 Sep 2016 08:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297588#M62523</guid>
      <dc:creator>t_ar_taat</dc:creator>
      <dc:date>2016-09-11T08:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297697#M62555</link>
      <description>&lt;P&gt;Some times picking your variable names may be sufficient. Please look at this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _test;
 VAR_A_A=1;
 VAR_A_B=2;
 VAR_A_C=3;

 VAR_B_A=100;
 VAR_B_B=200;
 VAR_B_C=300;

 Sum1 = sum(of Var_A:);
 Sum2 = Sum(of Var_B:);
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Sep 2016 08:01:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297697#M62555</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-12T08:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Designate variable name with intermediate match</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297984#M62625</link>
      <description>&lt;P&gt;Hi,ballardw&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes,actually the way you showed is also good.&lt;/P&gt;&lt;P&gt;Thank you for your posting.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 12:10:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Designate-variable-name-with-intermediate-match/m-p/297984#M62625</guid>
      <dc:creator>t_ar_taat</dc:creator>
      <dc:date>2016-09-13T12:10:58Z</dc:date>
    </item>
  </channel>
</rss>

