<?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: global or local output variable? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61400#M13338</link>
    <description>Also, here's a very useful and pertinent SAS support website &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; DOC supplement tech note reference, found using the site's SEARCH facility:&lt;BR /&gt;
&lt;BR /&gt;
Special Cases of Scope with the CALL SYMPUT Routine - SAS v9 DOC:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/tw3514-symput.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/tw3514-symput.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Examples of Macro Variable Scopes - SAS v8 but still applies today:&lt;BR /&gt;
&lt;A href="http://v8doc.sas.com/sashtml/macro/z1072111.htm" target="_blank"&gt;http://v8doc.sas.com/sashtml/macro/z1072111.htm&lt;/A&gt;</description>
    <pubDate>Tue, 04 Aug 2009 17:03:35 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-08-04T17:03:35Z</dc:date>
    <item>
      <title>global or local output variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61397#M13335</link>
      <description>Hello all;&lt;BR /&gt;
&lt;BR /&gt;
I have a macro that runs just fine. It is just that I want to call a piece of it somewhere else outside the macro without adding an additional data step.  Code below followed by question:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
%macro split (data=, var=, var1=, var2=);&lt;BR /&gt;
   proc sort data=&amp;amp;data(keep=&amp;amp;var &amp;amp;var1 &amp;amp;var2) out=values nodupkey;&lt;BR /&gt;
    by &amp;amp;var;&lt;BR /&gt;
   run;&lt;BR /&gt;
   data _null_;&lt;BR /&gt;
      set values end=last;&lt;BR /&gt;
      call symputx('M'||left(_n_),&amp;amp;var);&lt;BR /&gt;
      if last then call symput('count',_n_);&lt;BR /&gt;
   run;&lt;BR /&gt;
%put _local_;&lt;BR /&gt;
.....rest of macro&lt;BR /&gt;
&lt;BR /&gt;
%mend split;&lt;BR /&gt;
%split(data=HISTORY.ACUTEEXP, var=VISIT, Var1=start ,var2=end);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My question concerns the line: &lt;BR /&gt;
if last then call symput('count',_n_);&lt;BR /&gt;
&lt;BR /&gt;
I should be be able to call the "count" after the macro runs into anoter part of program? &lt;BR /&gt;
If I try to call it, it remains unresolved.&lt;BR /&gt;
&lt;BR /&gt;
Any solutions, greatly appreciated.&lt;BR /&gt;
&lt;BR /&gt;
~Lawrence</description>
      <pubDate>Tue, 04 Aug 2009 15:48:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61397#M13335</guid>
      <dc:creator>_LB</dc:creator>
      <dc:date>2009-08-04T15:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: global or local output variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61398#M13336</link>
      <description>force the value into the global environment by replacing symput() with symputx(), like:&lt;BR /&gt;
&lt;BR /&gt;
if last then call symputX('count',_n_, 'g' );</description>
      <pubDate>Tue, 04 Aug 2009 16:04:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61398#M13336</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-08-04T16:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: global or local output variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61399#M13337</link>
      <description>Peter;&lt;BR /&gt;
Worked like a charm!&lt;BR /&gt;
Much Thanks!&lt;BR /&gt;
&lt;BR /&gt;
Lawrence</description>
      <pubDate>Tue, 04 Aug 2009 16:10:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61399#M13337</guid>
      <dc:creator>_LB</dc:creator>
      <dc:date>2009-08-04T16:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: global or local output variable?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61400#M13338</link>
      <description>Also, here's a very useful and pertinent SAS support website &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt; DOC supplement tech note reference, found using the site's SEARCH facility:&lt;BR /&gt;
&lt;BR /&gt;
Special Cases of Scope with the CALL SYMPUT Routine - SAS v9 DOC:&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/tw3514-symput.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/tw3514-symput.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Examples of Macro Variable Scopes - SAS v8 but still applies today:&lt;BR /&gt;
&lt;A href="http://v8doc.sas.com/sashtml/macro/z1072111.htm" target="_blank"&gt;http://v8doc.sas.com/sashtml/macro/z1072111.htm&lt;/A&gt;</description>
      <pubDate>Tue, 04 Aug 2009 17:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/global-or-local-output-variable/m-p/61400#M13338</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-04T17:03:35Z</dc:date>
    </item>
  </channel>
</rss>

