<?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: How to use macro to store the value of median for a variable? Options in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5297#M2139</link>
    <description>Thanks guys!</description>
    <pubDate>Thu, 01 Nov 2007 16:16:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2007-11-01T16:16:58Z</dc:date>
    <item>
      <title>How to use macro to store the value of median for a variable? Options</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5294#M2136</link>
      <description>Hi Guys: &lt;BR /&gt;
&lt;BR /&gt;
My overall objective is: From the dataset, I want to compute the &lt;BR /&gt;
median of variable A, and use this value,(say median) to create a &lt;BR /&gt;
dummy variable, D, where D=1 if A_i&amp;gt;=median and 0 otherwise.(i stands &lt;BR /&gt;
for the ith observation of variable A). &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
How to do that using macro because I need to create this kind of dummy &lt;BR /&gt;
variables for many different datasets. Thanks in advance!!! &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Richard</description>
      <pubDate>Wed, 31 Oct 2007 22:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5294#M2136</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-10-31T22:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro to store the value of median for a variable? Options</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5295#M2137</link>
      <description>Hi:&lt;BR /&gt;
   This is not really an ODS or BASE Reporting procedure (PRINT, REPORT, TABULATE) question. Your best bet for help with this question is to search  for user group papers on applications for macro variables or to contact Tech Support. &lt;BR /&gt;
For example, here are a few user group papers that might be relevant:&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi24/Coders/p087-24.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi24/Coders/p087-24.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi28/090-28.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi28/090-28.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://ndc.mayo.edu/mayo/research/biostat/sasmacros.cfm" target="_blank"&gt;http://ndc.mayo.edu/mayo/research/biostat/sasmacros.cfm&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Thu, 01 Nov 2007 01:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5295#M2137</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2007-11-01T01:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro to store the value of median for a variable? Options</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5296#M2138</link>
      <description>Try this:&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;
%macro flag_median(var=,inmem=,outmem=);&lt;BR /&gt;
proc summary data=&amp;amp;inmem nway missing;&lt;BR /&gt;
  var &amp;amp;var;&lt;BR /&gt;
  output out=median(drop=_type_) median=;&lt;BR /&gt;
run;&lt;BR /&gt;
proc sql noprint;&lt;BR /&gt;
  select &amp;amp;var,_freq_ into :median separated by ' ',:count separated by ' '&lt;BR /&gt;
    from median;&lt;BR /&gt;
  quit;&lt;BR /&gt;
proc delete data=median;&lt;BR /&gt;
run;&lt;BR /&gt;
%put Median for &amp;amp;count observations of variable &amp;lt;&amp;amp;var&amp;gt; is &amp;amp;median;&lt;BR /&gt;
data &amp;amp;outmem;&lt;BR /&gt;
  set &amp;amp;inmem;&lt;BR /&gt;
  &amp;amp;var._median = &amp;amp;median;&lt;BR /&gt;
  flag_&amp;amp;var = (&amp;amp;var =&amp;gt; &amp;amp;var._median);&lt;BR /&gt;
run;&lt;BR /&gt;
proc print data=&amp;amp;outmem;&lt;BR /&gt;
run; &lt;BR /&gt;
%mend  flag_median;&lt;BR /&gt;
%flag_median(var=Height,inmem=sashelp.class,outmem=outstuff);&lt;BR /&gt;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2007 13:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5296#M2138</guid>
      <dc:creator>advoss</dc:creator>
      <dc:date>2007-11-01T13:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to use macro to store the value of median for a variable? Options</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5297#M2139</link>
      <description>Thanks guys!</description>
      <pubDate>Thu, 01 Nov 2007 16:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-use-macro-to-store-the-value-of-median-for-a-variable/m-p/5297#M2139</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2007-11-01T16:16:58Z</dc:date>
    </item>
  </channel>
</rss>

