<?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 Create String for Proc Format from Macro Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-String-for-Proc-Format-from-Macro-Variables/m-p/113451#M23376</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create a prompt that will allow users to pick a variable to summarize on a map.&amp;nbsp; Since the variables will all have different ranges of values, I created a univariate that will group values to summarize by when the project is run.&amp;nbsp; The problem I am having is converting the macro variables I create from the univariate into strings for a proc format statement (the proc format will be used to set the legend values of the map).&amp;nbsp; For example, if &amp;amp;Quant_20 resolves to say 5%, I would like to format the first value of the proc format to read "&amp;lt; 5%" and the next string will be the value between &amp;amp;Quant_20 and &amp;amp;Quant_40.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the solution is some kind of %symfunc statement using cats() to join the strings, but either I can't get the double quotes correct or I am going down the wrong path.&amp;nbsp; Below is some sample code. Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc univariate data=calcVar noprint; &lt;/P&gt;&lt;P&gt;&amp;nbsp; var Per_Metric;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=Quantile&lt;/P&gt;&lt;P&gt;&amp;nbsp; n=ny mean=meany&lt;/P&gt;&lt;P&gt;&amp;nbsp; pctlpts=0 to 100 by 20&lt;/P&gt;&lt;P&gt;&amp;nbsp; pctlpre=py_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Quantile;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_20',PY_20);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_40',PY_40);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_60',PY_60);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_80',PY_80);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;Quant_20 &amp;amp;Quant_40 &amp;amp;Quant_60 &amp;amp;Quant_80;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value Groups&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1=&amp;amp;Quant_20.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2=&amp;amp;Quant_40.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3=&amp;amp;Quant_60.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4=&amp;amp;Quant_80.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5=&amp;amp;Quant_20.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Aug 2013 16:21:54 GMT</pubDate>
    <dc:creator>P5C768</dc:creator>
    <dc:date>2013-08-16T16:21:54Z</dc:date>
    <item>
      <title>Create String for Proc Format from Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-String-for-Proc-Format-from-Macro-Variables/m-p/113451#M23376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to create a prompt that will allow users to pick a variable to summarize on a map.&amp;nbsp; Since the variables will all have different ranges of values, I created a univariate that will group values to summarize by when the project is run.&amp;nbsp; The problem I am having is converting the macro variables I create from the univariate into strings for a proc format statement (the proc format will be used to set the legend values of the map).&amp;nbsp; For example, if &amp;amp;Quant_20 resolves to say 5%, I would like to format the first value of the proc format to read "&amp;lt; 5%" and the next string will be the value between &amp;amp;Quant_20 and &amp;amp;Quant_40.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the solution is some kind of %symfunc statement using cats() to join the strings, but either I can't get the double quotes correct or I am going down the wrong path.&amp;nbsp; Below is some sample code. Any help is greatly appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc univariate data=calcVar noprint; &lt;/P&gt;&lt;P&gt;&amp;nbsp; var Per_Metric;&lt;/P&gt;&lt;P&gt;&amp;nbsp; output out=Quantile&lt;/P&gt;&lt;P&gt;&amp;nbsp; n=ny mean=meany&lt;/P&gt;&lt;P&gt;&amp;nbsp; pctlpts=0 to 100 by 20&lt;/P&gt;&lt;P&gt;&amp;nbsp; pctlpre=py_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set Quantile;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_20',PY_20);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_40',PY_40);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_60',PY_60);&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symput ('Quant_80',PY_80);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;Quant_20 &amp;amp;Quant_40 &amp;amp;Quant_60 &amp;amp;Quant_80;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;/P&gt;&lt;P&gt;&amp;nbsp; value Groups&lt;/P&gt;&lt;P&gt;&amp;nbsp; 1=&amp;amp;Quant_20.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 2=&amp;amp;Quant_40.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 3=&amp;amp;Quant_60.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 4=&amp;amp;Quant_80.&lt;/P&gt;&lt;P&gt;&amp;nbsp; 5=&amp;amp;Quant_20.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2013 16:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-String-for-Proc-Format-from-Macro-Variables/m-p/113451#M23376</guid>
      <dc:creator>P5C768</dc:creator>
      <dc:date>2013-08-16T16:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create String for Proc Format from Macro Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-String-for-Proc-Format-from-Macro-Variables/m-p/113452#M23377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Proc format can take a dataset as inputs, rather than mucking around with macro variables. Look up cntlin= datasets and how to format your dataset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2007/068-2007.pdf" target="_blank" title="http://www2.sas.com/proceedings/forum2007/068-2007.pdf"&gt;http://www2.sas.com/proceedings/forum2007/068-2007.pdf&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2013 16:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-String-for-Proc-Format-from-Macro-Variables/m-p/113452#M23377</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-08-16T16:24:29Z</dc:date>
    </item>
  </channel>
</rss>

