<?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: Get column value from column name as string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198184#M37103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art, I think we have a winner: Reeza!&lt;/P&gt;&lt;P&gt;As for my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var channel--c; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*This is to assume all of the variable are char, and fit them all in an array*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(vname(var),var);&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*This is to assign the value to the same-name macro variable*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; value=resolve(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;amp;&amp;amp;&amp;amp;channel'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*Not like Symget(), Resolve () will resolve to the bottom&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt; of a macro variable for instance of first row:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;&amp;amp;channel -&amp;gt; &amp;amp;B -&amp;gt; 2*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Apr 2015 00:11:52 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2015-04-17T00:11:52Z</dc:date>
    <item>
      <title>Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198178#M37097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a dataset where fields are: CHANNEL | A | B | C&lt;/P&gt;&lt;P&gt;- CHANNEL is a character field which cointains 'A', 'B', or 'C'&lt;/P&gt;&lt;P&gt;- A, B, C are numeric fileds which contain some numbers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to create in a datastep a new column VALUE, with the following logic: if CHANNEL = 'A' then VALUE = A, if CHANNEL = 'B' THEN VALUE = B, etc.&lt;/P&gt;&lt;P&gt;In other words, VALUE must contain the respective value of the column indicated in field CHANNEL for each row.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="123" jive-data-cell="{&amp;quot;color&amp;quot;:&amp;quot;#000000&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;left&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;}" jive-data-header="{&amp;quot;color&amp;quot;:&amp;quot;#FFFFFF&amp;quot;,&amp;quot;backgroundColor&amp;quot;:&amp;quot;#6690BC&amp;quot;,&amp;quot;textAlign&amp;quot;:&amp;quot;center&amp;quot;,&amp;quot;padding&amp;quot;:&amp;quot;2&amp;quot;,&amp;quot;fontFamily&amp;quot;:&amp;quot;arial,helvetica,sans-serif&amp;quot;}" style="border: 1px solid rgb(0, 0, 0); width: 481px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;CHANNEL&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;A&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;B&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;" valign="middle"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="color: #ffffff; background-color: #6690bc; text-align: center; padding: 2px; font-family: arial,helvetica,sans-serif;"&gt;VALUE&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;B&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px; color: #000000; text-align: left; background-color: transparent;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;4&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;5&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;6&lt;/TD&gt;&lt;TD style="padding: 2px; color: #000000; text-align: left; background-color: transparent;"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;A&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;7&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;8&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;9&lt;/TD&gt;&lt;TD style="padding: 2px; color: #000000; text-align: left; background-color: transparent;"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;C&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12&lt;/TD&gt;&lt;TD style="color: #000000; text-align: left; padding: 2px; background-color: transparent;"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In real world CHANNELs are hundreds, so I can't add hundreds of if in the datastep, I'd like to write a more elegant solution in a few rows of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 20:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198178#M37097</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2015-04-16T20:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198179#M37098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you saying that you have hundreds of variables A B C or some non-sequentially named list of a hundred variables that you need to apply?&lt;/P&gt;&lt;P&gt;This works for you example but HUNDREDS of values for Channel are going to get a bit rough.&lt;/P&gt;&lt;P&gt;data work.junk;&lt;BR /&gt;input CHANNEL $ A&amp;nbsp; B C;&lt;BR /&gt;array ChannelKeys {3} $ _temporary_ ("A" "B" "C"); /* the values of CHANNEL you are searching for go here*/&lt;BR /&gt;array vars A B C; /* list of variables with values to assign go here*/&lt;BR /&gt;value = vars[whichc(channel, of ChannelKeys&lt;LI&gt;)];&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;datalines;&lt;BR /&gt;B 1 2 3&amp;nbsp; &lt;BR /&gt;A 4 5 6&amp;nbsp; &lt;BR /&gt;A 7 8 9&amp;nbsp; &lt;BR /&gt;C 10 11 12 &lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 20:50:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198179#M37098</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-04-16T20:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198180#M37099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have written one solution before using Hash, but here is another one using Revolve Function, based on your simplified scenario:&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; (CHANNEL A&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp; C) (:&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$8.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;C&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var channel--c;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(vname(var),var);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value=resolve(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;amp;&amp;amp;&amp;amp;channel'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: navy; background: white; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;It can be tweaked to adapt to your numeric variables if you have any. &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 21:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198180#M37099</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-16T21:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198181#M37100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank you BallardW for the test data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a lookup or mapping problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am sure there are issues with the case of the value of Channel&lt;/P&gt;&lt;P&gt;and the list of variables in the array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I figured this out with the help of Knuth, who has several programs about sorting and searching.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Category:Knuth" title="http://www.sascommunity.org/wiki/Category:Knuth"&gt;Category:Knuth - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.junk;&lt;/P&gt;&lt;P&gt;input CHANNEL $ A&amp;nbsp; B C;&lt;/P&gt;&lt;P&gt;array vars A B C; /* list of variables with values to assign go here*/&lt;/P&gt;&lt;P&gt;do i = 1 to dim(vars);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if Channel eq vname(vars(i)) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; value = vars(i);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;B 1 2 3&lt;/P&gt;&lt;P&gt;A 4 5 6&lt;/P&gt;&lt;P&gt;A 7 8 9&lt;/P&gt;&lt;P&gt;C 10 11 12&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc print data = &amp;amp;syslast;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; Donald E Knuth maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 21:49:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198181#M37100</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2015-04-16T21:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198182#M37101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="5068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Please explain, step-by-step, how your solution works. I, for one, would be very interested in learning about your technique.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 23:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198182#M37101</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-16T23:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198183#M37102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: navy; font-style: inherit; background-color: white; font-family: inherit;"&gt;&lt;STRONG&gt;Use the VVALUEX function&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: navy; font-style: inherit; background-color: white; font-family: inherit;"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: navy; font-style: inherit; background-color: white; font-family: inherit;"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: blue; background-color: white;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt; (CHANNEL A&amp;nbsp;&amp;nbsp;&amp;nbsp; B&amp;nbsp;&amp;nbsp;&amp;nbsp; C) (:&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: teal; background-color: white;"&gt;$8.&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: blue; background-color: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: #ffffc0;"&gt;B&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: #ffffc0;"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: #ffffc0;"&gt;A&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: #ffffc0;"&gt;C&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp; 11&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: blue; background-color: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: blue; background-color: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;&amp;nbsp;&amp;nbsp; value=vvaluex(channel)&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;SPAN style="color: navy; font-style: inherit; background-color: white; font-family: inherit;"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-family: 'Courier New'; color: black; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2015 23:43:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198183#M37102</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-16T23:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198184#M37103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art, I think we have a winner: Reeza!&lt;/P&gt;&lt;P&gt;As for my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var channel--c; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*This is to assume all of the variable are char, and fit them all in an array*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; var;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; symputx(vname(var),var);&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*This is to assign the value to the same-name macro variable*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; value=resolve(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;amp;&amp;amp;&amp;amp;channel'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;/*Not like Symget(), Resolve () will resolve to the bottom&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt; of a macro variable for instance of first row:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp;&amp;amp;channel -&amp;gt; &amp;amp;B -&amp;gt; 2*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 00:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198184#M37103</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-17T00:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198185#M37104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS does have an incredible deep bench for functions! Well done, Reeza!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 00:16:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198185#M37104</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-17T00:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198186#M37105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yay! What do I win &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I actually presented a talk on avoiding macro's on Wednesday at our user group meeting - this was one of my examples, so fresh in my head.&amp;nbsp; &lt;/P&gt;&lt;P&gt;*Presented as in wrote, unfortunately not able to actually attend and present &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't think I've ever seen the call symput and resolve used that way before, its a good solution too &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 00:33:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198186#M37105</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-04-17T00:33:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198187#M37106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ouch! Where's my styptic pencil? I think I've just been cut with Occam's Razer!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Minimally, you win both Haikuo's and my gratitude!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While your solution is clearly the best for this problem, I'm still interested in finding out more about Haikuo's approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've always learned that macro variables CAN'T be used in the data step in which they are created.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 00:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198187#M37106</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-17T00:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198188#M37107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Quote from Art :"&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;I've always learned that macro variables CAN'T be used in the data step in which they are created."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px; background-color: #ffffff;"&gt;True in general. Most of Macro elements will first be executed/resolved before go to the SAS compiler, unless you tell SAS not to. In above example, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'Courier New'; color: black; background: white;"&gt;value=resolve(&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Courier New'; color: purple; background: white;"&gt;'&amp;amp;&amp;amp;&amp;amp;channel'&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'Courier New'; color: black; background: white;"&gt;); used SINGLE quote to skip the Macro facility and directly enter the SAS execution, and only resolved when that statement is hit.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 01:05:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198188#M37107</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-17T01:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198189#M37108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you guys,&lt;/P&gt;&lt;P&gt;it is amazing how many alternatives there exists to this problem &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think Reeza's solution is the most elegant, but thank you all for your ideas, I learned a lot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 07:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198189#M37108</guid>
      <dc:creator>Edoedoedo</dc:creator>
      <dc:date>2015-04-17T07:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198190#M37109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably will need to add an INPUT() function to convert the character string returned by VVALUEX() function back to a number.&lt;/P&gt;&lt;P&gt;Also there is risk of rounding of the value caused by the number/character/number conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: 'Courier New'; color: black; background-color: white;"&gt; value=input(vvaluex(channel),32.)&lt;/SPAN&gt;&lt;SPAN style="font-style: inherit; font-size: 13px; font-family: 'Courier New'; color: black; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 11:50:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198190#M37109</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-04-17T11:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198191#M37110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Arthur.T ,&lt;/P&gt;&lt;P&gt;You can do it also. But I have to point out that way is NOT efficient ,including Bian HaiKuo's code .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array var channel--c;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do over var;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx(vname(var),var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;value=symgetn(CHANNEL);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 13:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198191#M37110</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-04-17T13:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198192#M37111</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Given Reeza's solution, &lt;A __default_attr="149594" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; will call for his Occam's Razer to cut your approach as well &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 13:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198192#M37111</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-17T13:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198193#M37112</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="5068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: I will try to be careful shaving the code but, seriously, I have never thought of these possibilities and usually throw in a CALL EXECUTE when I've needed to utilize variable values and couldn't do it directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is a rather useless example that simply transposes a file into one long record. I've always wanted a way to pass a value into an array declaration and the following method appears to work. This definitely gives me something extra to think about over the weekend:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (keep=all:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have nobs=numobs end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array vars channel--c;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx('nmobs',numobs*4);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array all(&amp;amp;&amp;amp;nmobs.) $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain all:;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do over vars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; all(i)=catt(vars);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if last then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 15:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198193#M37112</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-17T15:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198194#M37113</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art -&lt;/P&gt;&lt;P&gt;&amp;nbsp; That is not going to work.&lt;/P&gt;&lt;P&gt;&amp;nbsp; The value of the macro variable used in the ARRAY ALL statement is the value from before the data step starts executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp; Try adding %SYMDEL NMOBS ; statement before the DATA step and check the log for error messages.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 15:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198194#M37113</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-04-17T15:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198195#M37114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="149594" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;, are you sure it worked? It seems to me it can't. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; array all(&amp;amp;&amp;amp;nmobs.) $; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The time point when this macro variable is supposed to be resolved, it does not exist yet. It only exists after SAS code " call symputx('nmobs',numobs*4);" being executed,&amp;nbsp; which is way late for its call for being resolved.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may try to clean up your existing macro variables and give another shot. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 15:47:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198195#M37114</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-04-17T15:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198196#M37115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="5068" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; and &lt;A __default_attr="2431" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: You're both obviously correct! Whatever I had done worked before I posted the message, but I can't replicate it. The code fails miserably. Darn!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must have somehow created the macro variable while I was testing various iterations of the code. &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2015 15:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/198196#M37115</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2015-04-17T15:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Get column value from column name as string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/376171#M90257</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, can you help me get this? &amp;nbsp;According to SAS documentation, vvaluex takes expression as argument. But here you have variable 'channel' as argument. I think vvalue only takes variable as argument. Thanks !&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 22:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-column-value-from-column-name-as-string/m-p/376171#M90257</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2017-07-14T22:50:17Z</dc:date>
    </item>
  </channel>
</rss>

