<?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: Convert into a macro that will produce either the frequency report or the descriptive statistics in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604766#M175364</link>
    <description>&lt;P&gt;Thanks a lot for your follow-up reply. Assuming after preparation of our macro , we need to get one of the two included variable (i.e. month or airTemp only ). Consequently we need to edit the results to convey that. I tried to see if the current macro can give the results of 1 variable&amp;nbsp; eg month but it doesn't. Any advice will be greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Sun, 17 Nov 2019 01:15:32 GMT</pubDate>
    <dc:creator>mrahouma</dc:creator>
    <dc:date>2019-11-17T01:15:32Z</dc:date>
    <item>
      <title>Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604752#M175354</link>
      <description>&lt;P&gt;I want to covert a regular code (below)&amp;nbsp; into a macro that will produce either the frequency report or the descriptive&lt;BR /&gt;statistics report based on a value of a parameter that is passed to the macro.*/;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Original code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var month; class month;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ; var  AirTemp; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Myy Current trial code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro freq_Describe (MNTH=month AIR_Temp=AirTemp );
/*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var &amp;amp;MNTH.; class &amp;amp;MNTH.;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ; var &amp;amp;AIR_Temp.; run;
%mend freq_Describe;

%freq_Describe (MNTH=month ; AIR_Temp=AirTemp);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;usiing my trial code, I got several errors&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Line generated by the invoked macro "FREQ_DESCRIBE".&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 proc means data=VIRGINIAKEY ; var &amp;amp;AIR_Temp.; run;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError"&gt;200&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: Apparent symbolic reference AIR_TEMP not resolved.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, ;, /, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Line generated by the macro variable "MNTH".&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 month ; AIR_Temp=AirTemp&lt;/DIV&gt;&lt;DIV class="sasError"&gt;________&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Line generated by the macro variable "MNTH".&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 month ; AIR_Temp=AirTemp&lt;/DIV&gt;&lt;DIV class="sasError"&gt;________&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;96&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Any advice will be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2019 22:46:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604752#M175354</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-11-16T22:46:33Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604753#M175355</link>
      <description>&lt;P&gt;There are at least two problems with your code. You need commas between macro parameters in your MACRO statement and when you call it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro freq_Describe (MNTH=month, AIR_Temp=AirTemp );
/*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var &amp;amp;MNTH.; class &amp;amp;MNTH.;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ; var &amp;amp;AIR_Temp.; run;
%mend freq_Describe;

%freq_Describe (MNTH=month, AIR_Temp=AirTemp);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Nov 2019 22:57:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604753#M175355</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-16T22:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604756#M175357</link>
      <description>&lt;P&gt;It works . Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2019 22:59:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604756#M175357</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-11-16T22:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604762#M175360</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt; Is there a way to A) add a parameter to the macro that can control which variable is used for the report and 2) add titles that reflect the type of report (frequency or descriptive statistics) including a short&lt;BR /&gt;description of the variable (specifying the description of the variable as a parameter for the macro)? Sorry for overloading.&lt;BR /&gt;</description>
      <pubDate>Sat, 16 Nov 2019 23:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604762#M175360</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-11-16T23:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604765#M175363</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/288813"&gt;@mrahouma&lt;/a&gt;&amp;nbsp; - I'm not sure what you mean by "add a parameter to the macro that can control which variable is used for the report". If you could post where this variable would go in your code, then that would make it a lot clearer. Here is an example of adding a title.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro freq_Describe (MNTH=month, AIR_Temp=AirTemp, MyTitle =  );
/*frequency report for month*/;
proc means data=VIRGINIAKEY N ; var &amp;amp;MNTH.; class &amp;amp;MNTH.;run;
/*lists basic descriptive statistics (N, mean, standard deviation, minimum, and maximum) for air temperature*/;
proc means data=VIRGINIAKEY ;
title1 "&amp;amp;MyTitle";
 var &amp;amp;AIR_Temp.; run;
%mend freq_Describe;

%freq_Describe (MNTH=month, AIR_Temp=AirTemp, MyTitle = Air Temperatures);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 17 Nov 2019 00:53:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604765#M175363</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-17T00:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604766#M175364</link>
      <description>&lt;P&gt;Thanks a lot for your follow-up reply. Assuming after preparation of our macro , we need to get one of the two included variable (i.e. month or airTemp only ). Consequently we need to edit the results to convey that. I tried to see if the current macro can give the results of 1 variable&amp;nbsp; eg month but it doesn't. Any advice will be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 01:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604766#M175364</guid>
      <dc:creator>mrahouma</dc:creator>
      <dc:date>2019-11-17T01:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert into a macro that will produce either the frequency report or the descriptive statistics</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604767#M175365</link>
      <description>&lt;P&gt;Please provide an example of the data you have and the expected output you want.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2019 02:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Convert-into-a-macro-that-will-produce-either-the-frequency/m-p/604767#M175365</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-17T02:01:49Z</dc:date>
    </item>
  </channel>
</rss>

