<?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: Symput not resolved in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337113#M76508</link>
    <description>&lt;P&gt;In SAS, as in life, timing is everything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The software examines the statements within the DATA step, performing any set-up work and checking for syntax errors.&amp;nbsp; It does this before actually executing the DATA step, and before executing CALL SYMPUT.&amp;nbsp; Therefore, the software comes up with a syntax error in the PUT statement, since the macro variable has not yet been created.&amp;nbsp; An alternative version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call symputx('EXECTIME', time());&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;EXECTIME.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note how switching to CALL SYMPUTX gets rid of any messages about numeric to character conversion.&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2017 19:40:30 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-03-01T19:40:30Z</dc:date>
    <item>
      <title>Symput not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337107#M76504</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try to do something easy, it's not&amp;nbsp;working.&lt;/P&gt;&lt;P&gt;So frustrating!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data _null_;
call symput('EXECTIME', time());
put &amp;amp;EXECTIME.;
run;&lt;/PRE&gt;&lt;P&gt;The mistake is:&lt;/P&gt;&lt;PRE&gt;WARNING: Apparent symbolic reference EXECTIME not resolved.&lt;/PRE&gt;&lt;P&gt;And for the put line:&lt;/P&gt;&lt;PRE&gt;ERROR 22-322: Expecting a name.&lt;/PRE&gt;&lt;P&gt;What is wrong with this??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337107#M76504</guid>
      <dc:creator>fabdu92</dc:creator>
      <dc:date>2017-03-01T19:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Symput not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337113#M76508</link>
      <description>&lt;P&gt;In SAS, as in life, timing is everything.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The software examines the statements within the DATA step, performing any set-up work and checking for syntax errors.&amp;nbsp; It does this before actually executing the DATA step, and before executing CALL SYMPUT.&amp;nbsp; Therefore, the software comes up with a syntax error in the PUT statement, since the macro variable has not yet been created.&amp;nbsp; An alternative version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;call symputx('EXECTIME', time());&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%put &amp;amp;EXECTIME.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note how switching to CALL SYMPUTX gets rid of any messages about numeric to character conversion.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337113#M76508</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-03-01T19:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Symput not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337115#M76509</link>
      <description>&lt;P&gt;So stupid! ^^&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Astounding!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337115#M76509</guid>
      <dc:creator>fabdu92</dc:creator>
      <dc:date>2017-03-01T19:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Symput not resolved</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337117#M76510</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;You ar enot stupid

Here are a few solutions

data _null_;
   call symput('EXECTIME', put(time(),hhmm5.));
   time=symget('exectime');
   put time=;
run;quit;


%symdel exectime;
data _null_;
if _n_=0 then do;
  %let rc=%sysfunc(dosubl('
     %let exectime=%sysfunc(putn(%sysfunc(time()),HHMM5.));
     '));
  end;
  put "&amp;amp;EXECTIME.";
run;

11:43

%symdel exectime;
data _null_;
  if _n_=0 then do;
    %let rc=%sysfunc(dosubl('
      proc sql;
         select put(time(),hhmm.) into :exectime from sashelp.class(obs=1)
      ;quit;
    '));
  end;
  put "&amp;amp;exectime";
run;quit;

%symdel exectime;
data _null_;
  if _n_=0 then do;
    %let rc=%sysfunc(dosubl('
      data _null_;
         call symputx("EXECTIME", put(time(),hhmm5.),'G');
      ;run;
    '));
  end;
  put "&amp;amp;exectime";
run;quit;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2017 19:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Symput-not-resolved/m-p/337117#M76510</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-03-01T19:52:11Z</dc:date>
    </item>
  </channel>
</rss>

