<?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: Macro to do the following? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341232#M63288</link>
    <description>&lt;P&gt;You have no dataset attached.&lt;/P&gt;
&lt;P&gt;Use the macro provided in&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to convert your SAS dataset into a data step that can then be posted in a {i} window here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you describe looks, at least at first, like a job for proc means with by group processing, and possibly some additional calculations in a data step.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Mar 2017 15:18:16 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-03-15T15:18:16Z</dc:date>
    <item>
      <title>Macro to do the following?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341226#M63285</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;OK…. Let me simplify, simplify and let’s see if you can assist me…or point me in the right direction:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Say for example you have a "three column" spreadsheet in Excel....&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Subcategory &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Outlet &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Sales&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;I want to write a macro that will perform the following over the attached dataset:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;For subcategory1, for Outlet1:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Calculate mean, median and standard deviation for Sales greater than $1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Take natural logarithm of all Sales greater than $1&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;any Sales greater than (mean + 4*standard deviation) redefine as (mean + 4*standard deviation)&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;redefine all negative or missing values to the calculated mean.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Loop to next: For subcategory1, for Outlet2:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Do this for every Outlet….&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Do this for every Subcategory&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;So, the end will be a new “column” in the spreadsheet named ZSales…this is the new defined Sales by the macro…&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;Is this possible??? May I ask you to help me write this??&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Calibri" size="3"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:14:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341226#M63285</guid>
      <dc:creator>BE1109nb</dc:creator>
      <dc:date>2017-03-15T15:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to do the following?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341229#M63286</link>
      <description>&lt;P&gt;This is not an Excel forum. &amp;nbsp;If you want help on how to do this in SAS, then present some test data, in the form of a datastep (as structure is important). &amp;nbsp;And present what you want the output to look like.&lt;/P&gt;
&lt;P&gt;SAS datasteps/procedures are already loops, they process the observations 1 by 1, so to get mean and such like a simple proc means call will work.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341229#M63286</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-15T15:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to do the following?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341232#M63288</link>
      <description>&lt;P&gt;You have no dataset attached.&lt;/P&gt;
&lt;P&gt;Use the macro provided in&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to convert your SAS dataset into a data step that can then be posted in a {i} window here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you describe looks, at least at first, like a job for proc means with by group processing, and possibly some additional calculations in a data step.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:18:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341232#M63288</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-15T15:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro to do the following?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341233#M63289</link>
      <description>&lt;P&gt;There's no need for a macro. Look at SAS BY group processing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quick example:&lt;/P&gt;
&lt;P&gt;Proc sort data=SASHELP.class out=class; by sex;run;&lt;/P&gt;
&lt;P&gt;proc means data=class;&lt;/P&gt;
&lt;P&gt;By sex;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This looks like homework so I suggest you at least try it rather than ask for someone to do it for you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See support.sas.com/training/tutorial for YouTube tutorials. And you didn't attach any files.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Mar 2017 15:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Macro-to-do-the-following/m-p/341233#M63289</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-15T15:20:41Z</dc:date>
    </item>
  </channel>
</rss>

