<?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 pick a list of variables using strings in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375412#M90004</link>
    <description>&lt;P&gt;Dear SAS communities&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can use hx_: to pick out all the variables with names starting with "hx_"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but is there a way to pick out all the variables with names that end with some specific text? &amp;nbsp;for example: I want to pick out all the variables "diabetes_year", "ami_year", "menopause_year" by using "_year", is there such code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;Raymond&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 16:38:29 GMT</pubDate>
    <dc:creator>rykwong</dc:creator>
    <dc:date>2017-07-12T16:38:29Z</dc:date>
    <item>
      <title>pick a list of variables using strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375412#M90004</link>
      <description>&lt;P&gt;Dear SAS communities&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can use hx_: to pick out all the variables with names starting with "hx_"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but is there a way to pick out all the variables with names that end with some specific text? &amp;nbsp;for example: I want to pick out all the variables "diabetes_year", "ami_year", "menopause_year" by using "_year", is there such code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;Raymond&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 16:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375412#M90004</guid>
      <dc:creator>rykwong</dc:creator>
      <dc:date>2017-07-12T16:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: pick a list of variables using strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375413#M90005</link>
      <description>&lt;P&gt;You'd have to show where you are doing the task but, more than likely, you can use the reverse function, e.g.,&lt;/P&gt;
&lt;PRE&gt;if reverse(varname) =: 'reay_'; &lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 16:43:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375413#M90005</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-07-12T16:43:03Z</dc:date>
    </item>
    <item>
      <title>Re: pick a list of variables using strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375417#M90009</link>
      <description>&lt;P&gt;There is no way to do specify a variable list based on the ending of the name.&lt;/P&gt;
&lt;P&gt;You could build a list of names by querying the metadata of the data source.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=have noprint out=contents; run;
proc sql noprint;
%let varlist=;
select varnum,name
  into :dummy,:varlist separated by ' '
  from contents
  where upcase(name) like '%^_YEAR' escape '^'
  order by varnum
;
quit;
data want ;
  set have ;
  max_year_value = max(of . &amp;amp;varlist );
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jul 2017 17:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375417#M90009</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-12T17:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: pick a list of variables using strings</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375422#M90012</link>
      <description>&lt;P&gt;Not directly. &amp;nbsp;A lazy way is to specify all numeric variables and store your results in a table. Then you can filter the results easily using the code from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;to filter the results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to limit the results before hand you can use the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 17:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pick-a-list-of-variables-using-strings/m-p/375422#M90012</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-12T17:24:23Z</dc:date>
    </item>
  </channel>
</rss>

