<?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 Compute a Value rather than Store a String in Developers</title>
    <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214459#M4670</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let measureSummed = &amp;amp;measureTy || &amp;amp;_sum;&lt;/P&gt;&lt;P&gt;%let measureSummed=%sysevalf(%sysfunc(translate(&amp;amp;measureSummed,+,||)));&lt;/P&gt;&lt;P&gt;%put &amp;amp;measureSummed;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 May 2015 23:28:47 GMT</pubDate>
    <dc:creator>slchen</dc:creator>
    <dc:date>2015-05-13T23:28:47Z</dc:date>
    <item>
      <title>Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214457#M4668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;Is there a way to compute and store rather than just store a string to be resolved later?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: blue; background: white;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; measureSummed = &amp;amp;measureTy || _sum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;I would like measureSummed to store the value of &amp;amp;measureTy + _sum instead of &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;&amp;amp;measureTy || _sum.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 20:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214457#M4668</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-13T20:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214458#M4669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In macro language, _sum is just 4 characters.&amp;nbsp; It is not something that can be added.&amp;nbsp; There are other variations that you might be looking for, such as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let measureSummed = &amp;amp;measureTy._sum;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let measureSummed = %eval(&amp;amp;measureTy + &amp;amp;_sum);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's possible you can do what you want to, but it's not 100% clear what you are trying to get from this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 20:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214458#M4669</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-13T20:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214459#M4670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%let measureSummed = &amp;amp;measureTy || &amp;amp;_sum;&lt;/P&gt;&lt;P&gt;%let measureSummed=%sysevalf(%sysfunc(translate(&amp;amp;measureSummed,+,||)));&lt;/P&gt;&lt;P&gt;%put &amp;amp;measureSummed;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 May 2015 23:28:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214459#M4670</guid>
      <dc:creator>slchen</dc:creator>
      <dc:date>2015-05-13T23:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214460#M4671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;I’m researching a few of the keywords used in your example. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;To clarify I have a column that is dynamically generated and SAS appends the text _sum to it.&amp;nbsp; measureTy is the first half of the column name. _sum is the second half.&amp;nbsp; Note _sum is not a variable.&amp;nbsp; An example of the full created column name is students_enrolled_sum.&amp;nbsp; Where measureTy is students enrolled and _sum needs to be appended.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;When I use:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;data enrollment; set enrollment;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="text-indent: .5in;"&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;rename &amp;amp;measureSummed = n;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt;I can’t have two strings in the rename &amp;amp;measureSummed = n;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 13:05:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214460#M4671</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-14T13:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214461#M4672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is the sashelp metadata files which contain the information about all tables/columns.&amp;nbsp; I find using that is easier than fiddling around with lists of ampersands, quoting etc.:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.vcolumn (where=(libname="WORK" and memname="XYZ" and substr(strip(reverse(NAME)),1,3)="MUS"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symputx('YOUR_VAR',name);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or just generate the necessary code from a call execute.&amp;nbsp; Or alternatively keep a running dataset with the variable name plus _sum, and use that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 13:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214461#M4672</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-14T13:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214462#M4673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If measureTy is a macro variable, this is easy:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let measureSummed = &amp;amp;measureTy._sum;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(It gets a little more complicated if &amp;amp;MeasureTy contains an embedded blank.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But your description makes it sound like measureTy is a DATA step variable.&amp;nbsp; In that case, SAS can do what you want, but the process needs to be split into two steps.&amp;nbsp; The reason is that SAS needs to know all the variables that a DATA step will process before it runs the DATA step.&amp;nbsp; But running the DATA step is required to examine the value of measureTy.&amp;nbsp; So here is a possibility:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call symputx('measureSummed', strip(measureTy) || '_sum');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or if measureTy contains an embedded blank that needs to be converted to an underscore:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call symputx('measureSummed', translate(strip(measureTy), '_', ' ') || '_sum');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then later in the program you can refer to &amp;amp;measureSummed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are we getting close?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 13:29:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214462#M4673</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-05-14T13:29:26Z</dc:date>
    </item>
    <item>
      <title>Re: Let Compute a Value rather than Store a String</title>
      <link>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214463#M4674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif; background: white;"&gt;This solved it:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif; background: white;"&gt;%let measureSummed = &amp;amp;measureTy._sum;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Helvetica, sans-serif; background: white;"&gt;measureTy is a marco variable that I concatenated with the text _sum in the datastep.&lt;/SPAN&gt;&lt;SPAN style="font-size: 11.0pt; font-family: 'Arial',sans-serif; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 May 2015 13:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Developers/Let-Compute-a-Value-rather-than-Store-a-String/m-p/214463#M4674</guid>
      <dc:creator>DavidPhillips2</dc:creator>
      <dc:date>2015-05-14T13:38:47Z</dc:date>
    </item>
  </channel>
</rss>

