<?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: %Let from a Value in a table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762767#M241532</link>
    <description>&lt;P&gt;Moving data into macro-variables for calculations is a bad idea in approximately 100% times. So please tell us what you are trying to. I am sure, that a solution can be developed that allows the data to stay in its natural living space.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2021 07:09:05 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2021-08-20T07:09:05Z</dc:date>
    <item>
      <title>%Let from a Value in a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762615#M241476</link>
      <description>I currently have code with a bunch of %let statements which are then used to do calculations with my data. My goal is to create a macro that reads in a sas table and changes those %let value statements. Is there a way to assign %let to variable values in a table?</description>
      <pubDate>Thu, 19 Aug 2021 17:51:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762615#M241476</guid>
      <dc:creator>vicmaria98</dc:creator>
      <dc:date>2021-08-19T17:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: %Let from a Value in a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762622#M241479</link>
      <description>&lt;P&gt;Run the below code to learn about an alternative:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _NULL_;
 set sashelp.class;
 call symputx('NAME'!!strip(put(_N_,8.)),name);
run;
%PUT &amp;amp;=NAME1;
%PUT &amp;amp;=NAME2;
%PUT &amp;amp;=NAME3;
%PUT &amp;amp;=NAME19;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 17:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762622#M241479</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-08-19T17:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: %Let from a Value in a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762636#M241483</link>
      <description>&lt;P&gt;%LET creates macro variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are many other ways to create macro variables from tables - CALL SYMPUTX() or PROC SQL are two ways.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So let's look at creating macro variables for all the names in the CLASS data set, with a data step and a macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name into :sql_name1-
from sashelp.class;
quit;

%put &amp;amp;sql_name1.;
%put &amp;amp;sql_name19.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And via data step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
*for debugging;
*data demo;
set sashelp.class;

macro_variable_name = catt('dataStep_name', put(_n_, 2. -l));

call symputx(macro_variable_name, name);

run;

%put &amp;amp;dataStep_name1;
%put &amp;amp;dataStep_name19.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/393967"&gt;@vicmaria98&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I currently have code with a bunch of %let statements which are then used to do calculations with my data. My goal is to create a macro that reads in a sas table and changes those %let value statements. Is there a way to assign %let to variable values in a table?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 18:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762636#M241483</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-19T18:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: %Let from a Value in a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762697#M241503</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;I currently have code with a bunch of %let statements which are then used to do calculations with my data.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;It's much easier to do calculations in a DATA step than in macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;My goal is to create a macro that reads in a sas table and changes those %let value statements. Is there a way to assign %let to variable values in a table?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So your data is in a SAS "table", do the calculations in a DATA step. Much much easier. Macros are likely unnecessary.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you think macro variables will help here?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 21:08:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762697#M241503</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-08-19T21:08:48Z</dc:date>
    </item>
    <item>
      <title>Re: %Let from a Value in a table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762767#M241532</link>
      <description>&lt;P&gt;Moving data into macro-variables for calculations is a bad idea in approximately 100% times. So please tell us what you are trying to. I am sure, that a solution can be developed that allows the data to stay in its natural living space.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 07:09:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Let-from-a-Value-in-a-table/m-p/762767#M241532</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-08-20T07:09:05Z</dc:date>
    </item>
  </channel>
</rss>

