<?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: ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247228#M46320</link>
    <description>&lt;P&gt;I am not sure why the need for all that code? &amp;nbsp;Simply normalise your data - long dataset rather than wide dataset - and put a by statement in your proc means. &amp;nbsp;Then transpose up the resulting data as you want in a datastep. &amp;nbsp;No need for macro's, macro looping, create datasets code, delete temporaries etc. &amp;nbsp;Far cleaner. &amp;nbsp;If you post some test data in the form of a datastep, and what you want the output to look like I can provide some code.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Feb 2016 15:40:06 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-02-01T15:40:06Z</dc:date>
    <item>
      <title>ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247215#M46317</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My following macro did not run for the reasons :&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword MACRO appears as text. A semicolon or other delimiter may be missing.&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword DO appears as text. A semicolon or other delimiter may be missing.&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword IF appears as text. A semicolon or other delimiter may be missing.&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May you let me know what I missed in the macros ? &amp;nbsp;Thank you very much. &amp;nbsp;Ivy&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro ps_summary (inds = , outds= , cohort = );&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table stat (_TYPE_ num,&lt;BR /&gt;_FREQ_ num,&lt;BR /&gt;psmean num,&lt;BR /&gt;pcmmean num,&lt;BR /&gt;psstd num,&lt;BR /&gt;pcmstd num,&lt;BR /&gt;psmed num,&lt;BR /&gt;pcmmed num,&lt;BR /&gt;psmin num,&lt;BR /&gt;pcmmin num,&lt;BR /&gt;psmax num,&lt;BR /&gt;pcmmax num,&lt;BR /&gt;pcmvar num);&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select count(pcm_var) into: pcmvar_cnt&lt;BR /&gt;from ads.pcm_names&lt;BR /&gt;where index(pcm_var, "CCMD" ) &amp;gt; 0 or index(pcm_var, "score") &amp;gt; 0 or index(pcm_var, "CCMA") &amp;gt; 0 ;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%do i = 1 %to &amp;amp;pcmvar_cnt.;&lt;/P&gt;&lt;P&gt;proc means data = &amp;amp;inds. ;&lt;BR /&gt;var performance_value %scan(&amp;amp;pcmvar., &amp;amp;i. );&lt;BR /&gt;where %scan(&amp;amp;pcmvar., &amp;amp;i. ) ^= . ;&lt;BR /&gt;output out = summary_&amp;amp;i. mean = psmean pcmmean std = psstd pcmstd median = psmed pcmmed min= psmin pcmmin max = psmax pcmmax ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%if %sysfunc(exist(summary_&amp;amp;i.) %then %do ;&lt;/P&gt;&lt;P&gt;data stat_&amp;amp;i.;&lt;BR /&gt;set summary;&lt;BR /&gt;length pcmvar $30. ;&lt;BR /&gt;pcmvar= "%scan(&amp;amp;pcmvar., &amp;amp;i. )";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data stat ;&lt;BR /&gt;set stat stat_i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc datasets library = work ;&lt;BR /&gt;delete summary_&amp;amp;i. stat_&amp;amp;i. ;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data &amp;amp;outds.;&lt;BR /&gt;set stat;&lt;BR /&gt;pcm_mean_sd_&amp;amp;cohort. = cat(put(pcmmean,5.2)," (",put(pcmstd,5.2),")");&lt;BR /&gt;pcm_range_&amp;amp;cohort. = cat(put(pcmmed,5.2)," (",put(pcmmin,5.2),",",put(pcmmax,5.2),")");&lt;BR /&gt;ps_mean_sd_&amp;amp;cohort. = cat(put(psmean,5.2)," (",put(psstd,5.2),")");&lt;BR /&gt;ps_range_&amp;amp;cohort. = cat(put(psmed,5.2)," (",put(psmin,5.2),",",put(psmax,5.2),")");&lt;BR /&gt;pcm_n_&amp;amp;cohort. = _freq_;&lt;BR /&gt;ps_n_&amp;amp;cohort. = _freq_;&lt;BR /&gt;label pcm_mean_sd_&amp;amp;cohort. = "Mean (SD)"&lt;BR /&gt;pcm_range_&amp;amp;cohort.= "Median (Min, Max)"&lt;BR /&gt;ps_mean_sd_&amp;amp;cohort.="Mean (SD)"&lt;BR /&gt;ps_range_&amp;amp;cohort.= "Median (Min, Max)"&lt;BR /&gt;pcm_n_&amp;amp;cohort. = "N"&lt;BR /&gt;ps_n_&amp;amp;cohort. = "N";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 15:12:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247215#M46317</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-01T15:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247219#M46318</link>
      <description>&lt;P&gt;You need to look for the cause in the code submitted before the lines you sent. &amp;nbsp;You must have missing semi-colon or unbalanced quotes or brackets that caused %MACRO to not be processed. The other errors should go away once you fix that. &amp;nbsp;You might just need to close SAS and start over.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 15:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247219#M46318</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-02-01T15:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247221#M46319</link>
      <description>&lt;P&gt;It looks like there are some missing semi-colons near the bottom. But, I'm wondering if you have custom code that is being inserted before a job submission. Or, if you have any other code before what you've shared here.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 15:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247221#M46319</guid>
      <dc:creator>DanZ</dc:creator>
      <dc:date>2016-02-01T15:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247228#M46320</link>
      <description>&lt;P&gt;I am not sure why the need for all that code? &amp;nbsp;Simply normalise your data - long dataset rather than wide dataset - and put a by statement in your proc means. &amp;nbsp;Then transpose up the resulting data as you want in a datastep. &amp;nbsp;No need for macro's, macro looping, create datasets code, delete temporaries etc. &amp;nbsp;Far cleaner. &amp;nbsp;If you post some test data in the form of a datastep, and what you want the output to look like I can provide some code.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 15:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247228#M46320</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-02-01T15:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Macro keyword MACRO appears as text.  A semicolon or other delimiter may be missing.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247283#M46338</link>
      <description>&lt;P&gt;Thank you very much, all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Found the problems, when I create the empty dataset, &amp;nbsp;I should use char. for one variable, however, I treated it as numeric variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2016 19:10:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-Macro-keyword-MACRO-appears-as-text-A-semicolon-or-other/m-p/247283#M46338</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-02-01T19:10:15Z</dc:date>
    </item>
  </channel>
</rss>

