<?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 modify MACRO to display MEDIAN? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422181#M280882</link>
    <description>&lt;P&gt;Mistakes from a quick scan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;SCAN Is being used incorrectly&lt;/LI&gt;
&lt;LI&gt;Macro is called before it’s declared&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Multiple %include for same program&lt;/LI&gt;
&lt;LI&gt;Incorrect use of DATA parameter -&amp;gt; this is a big one. Everything will be wrong if this isn’t done correctly because you’re not pointing at the data you think you are.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;I don’t think GOTO does what you think it’s doing&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oddly, the median part is actually correct....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/178332"&gt;@arrytanny&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am having some difficulty fixing this macro code&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname mylib 'C:\Users\Daddy\Documents';
%include 'C:\Users\Daddy\Desktop\face.sas';
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,data=tomhs);
run;


%macro face (group,sbpbl, sbp12, cholbl, chol12, hdlbl, hdl12, glucosbl, glucos12,data=tomhs,dec=3,all=all);
%do I = 1%to902;
%let depvar = %scan(&amp;amp;sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,&amp;amp;i);
%let%length (&amp;amp;depvar) = 0 %goto done;
 proc tabulate data=&amp;amp;tomhs noseps;
  class &amp;amp;group; sbpbl&amp;amp;depvar;
  table (&amp;amp;group &amp;amp;all), (&amp;amp;depvar)*(n*f=7.0 mean*f=7.&amp;amp;dec std*f=7.&amp;amp;dec
                                min*f=7.&amp;amp;dec max*f=7.&amp;amp;dec med*f=7.&amp;amp;dec)/rts=30;
 run;
%end;
 %done:
%mend face;
libname mylib'C:\Users\Daddy\Documents';

%include 'C:\Users\Daddy\Desktop\face.sas'
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12, data=tomhs);
run;&lt;/PRE&gt;
&lt;P&gt;Please how do I modify this macro code to display MEDIAN? Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Dec 2017 01:52:45 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-12-19T01:52:45Z</dc:date>
    <item>
      <title>How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422144#M280876</link>
      <description>&lt;P&gt;I am having some difficulty fixing this macro code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;libname mylib 'C:\Users\Daddy\Documents';
%include 'C:\Users\Daddy\Desktop\face.sas';
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,data=tomhs);
run;


%macro face (group,sbpbl, sbp12, cholbl, chol12, hdlbl, hdl12, glucosbl, glucos12,data=tomhs,dec=3,all=all);
%do I = 1%to902;
%let depvar = %scan(&amp;amp;sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,&amp;amp;i);
%let%length (&amp;amp;depvar) = 0 %goto done;
 proc tabulate data=&amp;amp;tomhs noseps;
  class &amp;amp;group; sbpbl&amp;amp;depvar;
  table (&amp;amp;group &amp;amp;all), (&amp;amp;depvar)*(n*f=7.0 mean*f=7.&amp;amp;dec std*f=7.&amp;amp;dec
                                min*f=7.&amp;amp;dec max*f=7.&amp;amp;dec med*f=7.&amp;amp;dec)/rts=30;
 run;
%end;
 %done:
%mend face;
libname mylib'C:\Users\Daddy\Documents';

%include 'C:\Users\Daddy\Desktop\face.sas'
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12, data=tomhs);
run;&lt;/PRE&gt;&lt;P&gt;Please how do I modify this macro code to display MEDIAN? Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 21:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422144#M280876</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-12-18T21:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422146#M280877</link>
      <description>&lt;P&gt;Are you claiming that this code works as intended, except that it fails to print the median?&amp;nbsp; That would be a surprise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps&amp;nbsp; you could post the original macro, before you started playing with it.&amp;nbsp; There are many issues to fix here.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:01:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422146#M280877</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-18T22:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422149#M280878</link>
      <description>&lt;P&gt;The first part runs,&lt;/P&gt;&lt;P&gt;afterwards the remaining part never works. It gives several error that I can not fathom.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422149#M280878</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-12-18T22:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422150#M280879</link>
      <description>&lt;P&gt;Si it fails to give an output that included MEDIAN&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422150#M280879</guid>
      <dc:creator>arrytanny</dc:creator>
      <dc:date>2017-12-18T22:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422151#M280880</link>
      <description>&lt;P&gt;If the first part runs, then post the contents of C:\Users\Daddy\Desktop\face.sas&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It may not print the median, but as long as it is working it can be tweaked to add the median to the report.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:15:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422151#M280880</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-18T22:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422152#M280881</link>
      <description>&lt;P&gt;Hint:&amp;nbsp; Set options mprint symbolgen mlogic;&lt;/P&gt;
&lt;P&gt;Run your code;&lt;/P&gt;
&lt;P&gt;Paste the generated statements and error messages from the&amp;nbsp;log&amp;nbsp;into a code box.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Dec 2017 22:18:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422152#M280881</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-12-18T22:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422181#M280882</link>
      <description>&lt;P&gt;Mistakes from a quick scan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;SCAN Is being used incorrectly&lt;/LI&gt;
&lt;LI&gt;Macro is called before it’s declared&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Multiple %include for same program&lt;/LI&gt;
&lt;LI&gt;Incorrect use of DATA parameter -&amp;gt; this is a big one. Everything will be wrong if this isn’t done correctly because you’re not pointing at the data you think you are.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;I don’t think GOTO does what you think it’s doing&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oddly, the median part is actually correct....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/178332"&gt;@arrytanny&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am having some difficulty fixing this macro code&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname mylib 'C:\Users\Daddy\Documents';
%include 'C:\Users\Daddy\Desktop\face.sas';
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,data=tomhs);
run;


%macro face (group,sbpbl, sbp12, cholbl, chol12, hdlbl, hdl12, glucosbl, glucos12,data=tomhs,dec=3,all=all);
%do I = 1%to902;
%let depvar = %scan(&amp;amp;sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12,&amp;amp;i);
%let%length (&amp;amp;depvar) = 0 %goto done;
 proc tabulate data=&amp;amp;tomhs noseps;
  class &amp;amp;group; sbpbl&amp;amp;depvar;
  table (&amp;amp;group &amp;amp;all), (&amp;amp;depvar)*(n*f=7.0 mean*f=7.&amp;amp;dec std*f=7.&amp;amp;dec
                                min*f=7.&amp;amp;dec max*f=7.&amp;amp;dec med*f=7.&amp;amp;dec)/rts=30;
 run;
%end;
 %done:
%mend face;
libname mylib'C:\Users\Daddy\Documents';

%include 'C:\Users\Daddy\Desktop\face.sas'
%face (group,sbpbl sbp12 cholbl chol12 hdlbl hdl12 glucosbl glucos12, data=tomhs);
run;&lt;/PRE&gt;
&lt;P&gt;Please how do I modify this macro code to display MEDIAN? Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 01:52:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422181#M280882</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-12-19T01:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify MACRO to display MEDIAN?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422184#M280883</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; In ;your TABLE statement, you have specified many statistics correctly -- for example, N, MEAN, STD, MIN, and MAX. However, you have this &lt;BR /&gt;&lt;FONT size="3"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#FF0000"&gt;med&lt;/FONT&gt;*f=7.&amp;amp;dec&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;in your TABLE statement and the correct specification for the MEDIAN statistic is either MEDIAN or P50, as shown in the documentation. &lt;BR /&gt;&lt;A href="http://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=p0n4welprckk8yn1ro9swaef6x0n.htm&amp;amp;locale=en" target="_blank"&gt;http://go.documentation.sas.com/?docsetId=proc&amp;amp;docsetVersion=9.4&amp;amp;docsetTarget=p0n4welprckk8yn1ro9swaef6x0n.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Look what happens when I try the "MED" statistic as a keyword in TABULATE:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tab_stats.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17384i28373B5FE88F0603/image-size/large?v=v2&amp;amp;px=999" role="button" title="tab_stats.png" alt="tab_stats.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 19 Dec 2017 02:14:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-modify-MACRO-to-display-MEDIAN/m-p/422184#M280883</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-12-19T02:14:57Z</dc:date>
    </item>
  </channel>
</rss>

