<?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 Missing Imputation Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177308#M33924</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a macro that replaces missing values with median. I tried to add 'mean' as a option type in macro. If user selects mean, it replaces missing values with mean. Otherwise, median.&lt;/P&gt;&lt;P&gt;It has been working fine. It started throwing errors since i use %IF %THEN %DO in the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Errors&lt;/STRONG&gt; :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #ff0000;"&gt;Macro keyword MACRO appears as text.&amp;nbsp; A semicolon or other delimiter may be missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt;"&gt;Macro keyword IF appears as text.&amp;nbsp; A semicolon or other delimiter may be missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14052587791394211" jivemacro_uid="_14052587791394211" modifiedtitle="true"&gt;
&lt;P&gt;options source2 mprint mlogic symbolgen;&lt;/P&gt;
&lt;P&gt;%macro replace (input= prac.file1,analysis=,vars=Q3-Q5,output=replaced); &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%if trim((left(&amp;amp;analysis)) = median %then %do;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc means data=&amp;amp;input noprint; &lt;/P&gt;
&lt;P&gt;var &amp;amp;vars;&lt;/P&gt;
&lt;P&gt;output out=dummy (drop=_type_ _freq_) median= / autoname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%else %do;&lt;/P&gt;
&lt;P&gt;proc means data=&amp;amp;input noprint; &lt;/P&gt;
&lt;P&gt;var &amp;amp;vars;&lt;/P&gt;
&lt;P&gt;output out=dummy (drop=_type_ _freq_) mean= / autoname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc transpose data=dummy out=dummy; &lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data _null_; &lt;/P&gt;
&lt;P&gt;set dummy end=last; &lt;/P&gt;
&lt;P&gt;call symput('med'||left(_n_),col1); &lt;/P&gt;
&lt;P&gt;if last then call symput('maxi',_n_); &lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data &amp;amp;output;&lt;/P&gt;
&lt;P&gt;set &amp;amp;input;&lt;/P&gt;
&lt;P&gt;array vars (*) &amp;amp;vars; &lt;/P&gt;
&lt;P&gt;%do i =1 %to &amp;amp;maxi; &lt;/P&gt;
&lt;P&gt; if vars(&amp;amp;i) = . then vars(&amp;amp;i)=&amp;amp;&amp;amp;med&amp;amp;i; &lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;run; &lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%replace (input&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;= prac.file1,analysis= mean,vars=Q1-Q5,output=replaced);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 13 Jul 2014 13:44:40 GMT</pubDate>
    <dc:creator>Ujjawal</dc:creator>
    <dc:date>2014-07-13T13:44:40Z</dc:date>
    <item>
      <title>Missing Imputation Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177308#M33924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a macro that replaces missing values with median. I tried to add 'mean' as a option type in macro. If user selects mean, it replaces missing values with mean. Otherwise, median.&lt;/P&gt;&lt;P&gt;It has been working fine. It started throwing errors since i use %IF %THEN %DO in the macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Errors&lt;/STRONG&gt; :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; color: #ff0000;"&gt;Macro keyword MACRO appears as text.&amp;nbsp; A semicolon or other delimiter may be missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt;"&gt;Macro keyword IF appears as text.&amp;nbsp; A semicolon or other delimiter may be missing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_14052587791394211" jivemacro_uid="_14052587791394211" modifiedtitle="true"&gt;
&lt;P&gt;options source2 mprint mlogic symbolgen;&lt;/P&gt;
&lt;P&gt;%macro replace (input= prac.file1,analysis=,vars=Q3-Q5,output=replaced); &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%if trim((left(&amp;amp;analysis)) = median %then %do;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc means data=&amp;amp;input noprint; &lt;/P&gt;
&lt;P&gt;var &amp;amp;vars;&lt;/P&gt;
&lt;P&gt;output out=dummy (drop=_type_ _freq_) median= / autoname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%else %do;&lt;/P&gt;
&lt;P&gt;proc means data=&amp;amp;input noprint; &lt;/P&gt;
&lt;P&gt;var &amp;amp;vars;&lt;/P&gt;
&lt;P&gt;output out=dummy (drop=_type_ _freq_) mean= / autoname;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;proc transpose data=dummy out=dummy; &lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data _null_; &lt;/P&gt;
&lt;P&gt;set dummy end=last; &lt;/P&gt;
&lt;P&gt;call symput('med'||left(_n_),col1); &lt;/P&gt;
&lt;P&gt;if last then call symput('maxi',_n_); &lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data &amp;amp;output;&lt;/P&gt;
&lt;P&gt;set &amp;amp;input;&lt;/P&gt;
&lt;P&gt;array vars (*) &amp;amp;vars; &lt;/P&gt;
&lt;P&gt;%do i =1 %to &amp;amp;maxi; &lt;/P&gt;
&lt;P&gt; if vars(&amp;amp;i) = . then vars(&amp;amp;i)=&amp;amp;&amp;amp;med&amp;amp;i; &lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;run; &lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;%replace (input&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;= prac.file1,analysis= mean,vars=Q1-Q5,output=replaced);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 13:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177308#M33924</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2014-07-13T13:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Missing Imputation Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177309#M33925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably have misplaced * or quotes that has SAS session confused.&amp;nbsp; If you cannot get it fixed then just close it and open a new one.&lt;/P&gt;&lt;P&gt;Your %IF condition will never be true because the string that started with the text TRIM( will never equal the string median.&amp;nbsp; You do not normally need to trim macro variables anyway.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you are working too hard.&amp;nbsp; Here is a version that will eliminate the macro logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; replace (input= prac.file1,analysis=,vars=Q3-Q5,output=replaced); &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* Generate analysis results ;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;proc means data=&amp;amp;input noprint;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; var &amp;amp;vars;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; output out=dummy1 (drop=_type_ _freq_) &amp;amp;analysis= ;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;run;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* Convert to vertical ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;proc transpose data=dummy1 out=dummy2 prefix=_analysis;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* Replace missing with analysis results ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;data &amp;amp;output;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; set &amp;amp;input;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; array _vars &amp;amp;vars ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; do p=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; to dim(_vars);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set dummy2(keep=_analysis1) point=p ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _vars(p)=coalesce(_vars(p),_analysis1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop _analysis1 ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;run;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;options&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;mprint&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;nosymbolgen&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;nomlogic&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; sashelp.class ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; age=&lt;/SPAN&gt;&lt;SPAN style="color: teal; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;replace&lt;/EM&gt;&lt;/STRONG&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(input=test&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,analysis= mean&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,vars=_numeric_&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,output=replaced&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;compare&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;compare&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;=replaced;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="color: navy; background: white; font-size: 10.0pt; font-family: 'Courier New';"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 14:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177309#M33925</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-13T14:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Missing Imputation Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177310#M33926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your reply. I have just reopened sas session and removed TRIM(LEFT( and it worked like a charm. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Could you please help me understand the reason? How TRIM(LEFT caused problem to the macro?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;"Your %IF condition will never be true because the string that started with the text TRIM( will never equal the string median.&amp;nbsp; You do not normally need to trim macro variables anyway."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 14:56:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177310#M33926</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2014-07-13T14:56:40Z</dc:date>
    </item>
    <item>
      <title>Re: Missing Imputation Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177311#M33927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Most likely you left some previous statement open because of unbalanced quotes or some other problem,&amp;nbsp;&amp;nbsp; So then every time after that it thinks the %MACRO statement is inside the middle of the previous expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem with your %IF condition is really separate.&amp;nbsp; If you wanted the macro to trim the value then you would need to use a macro function such as %TRIM().&amp;nbsp; To the macro the string TRIM() is just a bunch a characters. So TRIM(median) will never be equal to median since T does not equal m.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really did want to test if macro variable ANALYSIS had the value median then you would just do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test(x) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if median = &amp;amp;x %then %put Found ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %else %put Not Found ;&lt;/P&gt;&lt;P&gt;%mend test ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test();&lt;/P&gt;&lt;P&gt;Not Found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test(median);&lt;/P&gt;&lt;P&gt;Found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test(mean);&lt;/P&gt;&lt;P&gt;Not Found&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you might need to watch out for the case of the supplied values.&lt;/P&gt;&lt;P&gt;%test(Median);&lt;/P&gt;&lt;P&gt;Not Found&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Jul 2014 16:47:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Missing-Imputation-Macro/m-p/177311#M33927</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-07-13T16:47:55Z</dc:date>
    </item>
  </channel>
</rss>

