<?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: assign values to variables which started out as values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469507#M120123</link>
    <description>&lt;P&gt;CALL SYMPUTX().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jun 2018 04:03:22 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-12T04:03:22Z</dc:date>
    <item>
      <title>assign values to variables which started out as values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469488#M120113</link>
      <description>&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I assign values to the values within macro variables which I want to be variables in turn?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, let's say I assign a number of question codes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data question_vars;&lt;BR /&gt;&amp;nbsp;input question_code $25.;&lt;BR /&gt;&amp;nbsp;datalines;&lt;BR /&gt;QUESTION_CODE001&lt;/P&gt;&lt;P&gt;QUESTION_CODE002&lt;/P&gt;&lt;P&gt;QUESTION_CODE003&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select question_code into:&amp;nbsp;questioncodelist separated by ' '&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from question_vars;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, from here, how do I assign a value to QUESTION_CODE001?&amp;nbsp; In other words, I want to make the values within question_code&amp;nbsp; be variables unto which I can assign values to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 02:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469488#M120113</guid>
      <dc:creator>markc</dc:creator>
      <dc:date>2018-06-12T02:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to variables which started out as values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469501#M120119</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data question_vars;
 input question_code $25.;
 datalines;
QUESTION_CODE001
QUESTION_CODE002
QUESTION_CODE003
run;

proc sql noprint;
  select catt('&amp;amp;',question_code) into: questioncodelist separated by ' '
  from question_vars;
quit;

%let question_code001=a;
%let question_code002=b;
%let question_code003=c;

%put &amp;amp;=questioncodelist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;QUESTIONCODELIST=a b c&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 03:31:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469501#M120119</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-12T03:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to variables which started out as values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469506#M120122</link>
      <description>&lt;P&gt;Thank you very much for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm finding this one hard to put into words to be honest.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I would like to be able to read through a dataset and I would like to make the value of a variable, in turn be another variable which I can assign another value to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example let's say an observation contains:&lt;/P&gt;&lt;P&gt;Columns:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var1&amp;nbsp; var2&amp;nbsp; var3&lt;/P&gt;&lt;P&gt;Row 1 contents:&amp;nbsp;&amp;nbsp;AAA&amp;nbsp; BBB&amp;nbsp; CCC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So as I am reading through var1, I would like to be able to make its value i.e. AAA in turn be a variable name to which I can assign var3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other words:&lt;/P&gt;&lt;P&gt;let the value of (var1) = the value of var3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so that new variable AAA = CCC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks!&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>Tue, 12 Jun 2018 03:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469506#M120122</guid>
      <dc:creator>markc</dc:creator>
      <dc:date>2018-06-12T03:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to variables which started out as values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469507#M120123</link>
      <description>&lt;P&gt;CALL SYMPUTX().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 04:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469507#M120123</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-12T04:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: assign values to variables which started out as values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469508#M120124</link>
      <description>&lt;P&gt;Maybe this then?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  retain VAR1 'AAA'  VAR3 'CCC';
  call symputx(VAR1, VAR3);
  call execute('%put &amp;amp;='||VAR1);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;AAA=CCC&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jun 2018 04:03:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-values-to-variables-which-started-out-as-values/m-p/469508#M120124</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-06-12T04:03:47Z</dc:date>
    </item>
  </channel>
</rss>

