<?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: How to extract numbers from variables' names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337500#M76644</link>
    <description>&lt;P&gt;Use VNAME to get the variable name in an array.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use COMPRESS to retain only digits.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use INPUT to convert to a number.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Mar 2017 19:00:09 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-03-02T19:00:09Z</dc:date>
    <item>
      <title>How to extract numbers from variables' names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337499#M76643</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a wide form of longitudinal dataset recording&amp;nbsp;scores of multiple times like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID Group &amp;nbsp; Time0 Time1 Time4 Time9 Time15&amp;nbsp;Time24 Time37&lt;/STRONG&gt; (...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;17 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;9 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;8 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;29 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9&lt;/P&gt;&lt;P&gt;2 &amp;nbsp;A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;21 &amp;nbsp; &amp;nbsp; &amp;nbsp; 39 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;32 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;31 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 23&lt;/P&gt;&lt;P&gt;(...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I'm using array to convert this dataset to convert this dataset to the long form, like that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ID Group Time Score&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0 &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&lt;/P&gt;&lt;P&gt;1 &amp;nbsp; A &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(...)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Since there are lots of Timepoints in the wide data, and the numbers are irregular, I have to write a ton of "if...else" following the array, just to change values of variable "Time" in the new dataset.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I wonder if Is there any way to just extract the number following the variable Time0 Time4... and put it as the value in the new Time variable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks so much!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Joe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 18:59:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337499#M76643</guid>
      <dc:creator>joseph626</dc:creator>
      <dc:date>2017-03-02T18:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract numbers from variables' names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337500#M76644</link>
      <description>&lt;P&gt;Use VNAME to get the variable name in an array.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use COMPRESS to retain only digits.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use INPUT to convert to a number.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 19:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337500#M76644</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-02T19:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract numbers from variables' names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337513#M76646</link>
      <description>&lt;P&gt;Thanks Reeza!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did the following code and it get the jobs done!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	time = input(compress(vname(array[i]),,'kd'), 6.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2017 19:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-numbers-from-variables-names/m-p/337513#M76646</guid>
      <dc:creator>joseph626</dc:creator>
      <dc:date>2017-03-02T19:24:01Z</dc:date>
    </item>
  </channel>
</rss>

