<?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: Using call symputx in a macro program in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451050#M113652</link>
    <description>&lt;P&gt;If you want to make the macro variable from PROC SQL without the leading/trailing spaces you can use the TRIMMED keyword in the INTO clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max(run_date)
     , max(run_date) format weekdatx.
  into :&amp;amp;table._mrd trimmed
     , :&amp;amp;table._mrd_d trimmed
  from &amp;amp;table._chk
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 04 Apr 2018 12:17:49 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-04-04T12:17:49Z</dc:date>
    <item>
      <title>Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451025#M113638</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;I have tried to do some research on this before posting my question but am struggling to locate the answer. Basically, I am creating a&amp;nbsp;global macro variable within a macro program which is a date in weekdatx, format. I want to left align the variable, simply so it looks better when I reference it in the log but am struggling to do this. I can't include the whole macro program but the relevant part is: -&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;proc sql noprint;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;select&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;max(run_date)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;into: &amp;amp;table._mrd&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;from &amp;amp;table._chk;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;proc sql noprint;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;select&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;max(run_date) format &lt;FONT color="#008080"&gt;weekdatx.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;into: &amp;amp;table._mrd_d&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;from &amp;amp;table._chk;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;quit;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;　&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;data _null_;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;amp;table._mrd_d = left(&lt;FONT color="#800080"&gt;"&amp;amp;table._mrd_d"&lt;/FONT&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;call symputx(&lt;FONT color="#800080"&gt;"&amp;amp;table._mrd_d"&lt;/FONT&gt;,&amp;amp;table._mrd_d,&lt;FONT color="#800080"&gt;'G'&lt;/FONT&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;FONT color="#000080"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt; checkdates;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;%&lt;STRONG&gt;&lt;I&gt;checkdates&lt;/I&gt;&lt;/STRONG&gt;(dialler.mort_uip_dialler_list_&amp;amp;month,dm,MSP)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;FONT color="#0000ff"&gt;%put&lt;/FONT&gt; Maximum date on DM is &amp;amp;dm_mrd;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&lt;FONT color="#0000ff"&gt;%put&lt;/FONT&gt; Maximum date on DM is &amp;amp;dm_mrd_d;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;and my log shows this: -&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;1138 %put Maximum date on DM is &amp;amp;dm_mrd;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Maximum date on DM is 21278&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;1139 %put Maximum date on DM is &amp;amp;dm_mrd_d;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Maximum date on DM is dm_mrd_d&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;I'm satisfied that the macro variable is being created in SQL correctly as when I run the code without the symputx part, my log shows: -&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;1195 %put Maximum date on DM is &amp;amp;dm_mrd;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Maximum date on DM is 21278&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;1196 %put Maximum date on DM is &amp;amp;dm_mrd_d;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Maximum date on DM is&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wednesday, 4 April 2018&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;So it is just the symputx part where my coding is wrong. Would&amp;nbsp;anyone be able to advise where I'm going wrong?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Many thanks,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="2"&gt;Rob&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451025#M113638</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2018-04-04T11:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451041#M113645</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
    SELECT strip(put(max(run_date),weekdatx.))
    INTO : &amp;amp;table._mrd_d
    FROM &amp;amp;table._chk;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 11:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451041#M113645</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-04-04T11:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451047#M113649</link>
      <description>&lt;P&gt;if you just want to remove leading and trailing blanks from a macro variable, do this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let &amp;amp;table._mrd_d = &amp;amp;&amp;amp;table._mrd_d;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Please show the whole log of the macro call. Use the {i} button for posting code. Also who the whole macro code, the %macro definition is missing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:10:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451047#M113649</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-04T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451049#M113651</link>
      <description>&lt;P&gt;Thanks gamotte and Kurt. I was reluctant to put the whole macro code in as it is a work piece that references file names that it would be frowned upon if I were to share and I would have needed to change a significant amount of it in order to publish it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As always really appreciate members taking the time to look and respond to my questions so many thanks to you both.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451049#M113651</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2018-04-04T12:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451050#M113652</link>
      <description>&lt;P&gt;If you want to make the macro variable from PROC SQL without the leading/trailing spaces you can use the TRIMMED keyword in the INTO clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max(run_date)
     , max(run_date) format weekdatx.
  into :&amp;amp;table._mrd trimmed
     , :&amp;amp;table._mrd_d trimmed
  from &amp;amp;table._chk
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:17:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451050#M113652</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-04T12:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451068#M113659</link>
      <description>&lt;P&gt;It is more about providing a full minimal working code that can reproduce the problem without&lt;/P&gt;
&lt;P&gt;requiring the users to create their own test datasets or to guess and complete the missing parts.&lt;/P&gt;
&lt;P&gt;The exact names of variables and datasets are unimportant as long as they are not part of the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451068#M113659</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-04-04T12:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451071#M113660</link>
      <description>&lt;P&gt;Thanks Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One of the things I love about SAS is that there are so many different ways to get to the right end result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The trimmed keyword doesn't work for me at work but I think that is because I use an older version of SAS. I'll certainly give it a go on SAS&amp;nbsp;Studio when I get home though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:45:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451071#M113660</guid>
      <dc:creator>robulon</dc:creator>
      <dc:date>2018-04-04T12:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using call symputx in a macro program</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451074#M113661</link>
      <description>&lt;P&gt;The kludge for older versions of SAS (10 years ago?) was to use the SEPARATED BY keyword.&amp;nbsp; Just make sure that your query returns only one observation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;into :mvar separated by ' '&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Apr 2018 12:48:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-call-symputx-in-a-macro-program/m-p/451074#M113661</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-04-04T12:48:26Z</dc:date>
    </item>
  </channel>
</rss>

