<?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: SAS Macro error in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131858#M26848</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks CTorres,&lt;/P&gt;&lt;P&gt;I just noticed I was missing the input statement. I had the call symput function in my code but it got stripped out while copy- pasting here. I did not know you could use the strip function which is very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Jul 2013 17:53:45 GMT</pubDate>
    <dc:creator>saspert</dc:creator>
    <dc:date>2013-07-11T17:53:45Z</dc:date>
    <item>
      <title>SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131855#M26845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Need help on running the macro to declare numbered macro variables like pcode1, pcode2....&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;data&amp;nbsp; MESTGT.include_processes;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;length pname &lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 12pt; font-family: Courier New;"&gt;$20.&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;Finalsim&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;run;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;data&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;set &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; MESTGT.include_processes;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; symput (&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 12pt; font-family: Courier New;"&gt;'pcode'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;||_n_,pname);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; symput (&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 12pt; font-family: Courier New;"&gt;'nobs'&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;, _n_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;Error is below -&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 30:23&amp;nbsp;&amp;nbsp; 31:22&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;ERROR: Symbolic variable name PCODE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 must contain only letters, digits, and underscores.&lt;/P&gt;&lt;P&gt;NOTE: Invalid argument to function SYMPUT at line 30 column 6.&lt;/P&gt;&lt;P&gt;pname=&amp;nbsp; _ERROR_=1 _N_=1&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;NOTE: There were 1 observations read from the data set MESTGT.INCLUDE_PROCESSES.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #008000; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif;"&gt;Thanks,&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&lt;SPAN style="color: #000000; font-family: arial,helvetica,sans-serif; font-size: 10pt;"&gt;saspert.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 15:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131855#M26845</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2013-07-11T15:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131856#M26846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have several errors:&lt;/P&gt;&lt;P&gt;1. The input statement is missing in the first data step.&lt;/P&gt;&lt;P&gt;2. The correct use od sysmput is call symput.&lt;/P&gt;&lt;P&gt;3. You need to eliminate the spaces in _N_. Maybe using the Strip function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The correct syntax would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data&amp;nbsp; include_processes;&lt;/P&gt;&lt;P&gt;length pname $20.;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input pname;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;Finalsim&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data&amp;nbsp; _null_;&lt;/P&gt;&lt;P&gt;set include_processes;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call&lt;/STRONG&gt; symput ('pcode'||&lt;STRONG&gt;strip(_n_),&lt;/STRONG&gt;pname);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;call&lt;/STRONG&gt; symput ('nobs',&lt;STRONG&gt;strip(_n_)&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 16:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131856#M26846</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2013-07-11T16:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131857#M26847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saspert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quick good practice or trick to avoid having to debug removing leading or trailing blanks from SAS datasets character variables. The macro-facility with proc sql has exactly what you wanted to do "automated".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could've done the following:&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;proc sql noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select pname&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into : pcode1-: pcode99999999&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from MESTGT.include_processes;&lt;BR /&gt; quit;&lt;BR /&gt; &lt;BR /&gt; %let nobs=&amp;amp;sqlobs;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;*You will have to remove the space between the column and the macro variable names, I couldn't figure out how to disable the annoying emoticons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SQLOBS is an automatic variable set to the number of records of the last succesful sql query. Only &amp;amp;SQLOBS pcode variables are created, 99999999 was just an arbitrarily high number to make sure there are enough predefined.&lt;/P&gt;&lt;P&gt;The drawback is that if you use this within a macro, the &amp;amp;sqlobs gets replaced at compilation instead of during executing leading to a fault. You should be able to go around that with %nrstr or simply by doing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select pname, count(pname)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; into : pcode1-: pcode99999999, :nobs&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from MESTGT.include_processes&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt; quit;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this was useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 17:37:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131857#M26847</guid>
      <dc:creator>Vince28_Statcan</dc:creator>
      <dc:date>2013-07-11T17:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro error</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131858#M26848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks CTorres,&lt;/P&gt;&lt;P&gt;I just noticed I was missing the input statement. I had the call symput function in my code but it got stripped out while copy- pasting here. I did not know you could use the strip function which is very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jul 2013 17:53:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-error/m-p/131858#M26848</guid>
      <dc:creator>saspert</dc:creator>
      <dc:date>2013-07-11T17:53:45Z</dc:date>
    </item>
  </channel>
</rss>

