<?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: Min and max functions in SAS in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702786#M37768</link>
    <description>&lt;P&gt;Let's say I have this data set and I want to get the minimum and maximum average of new cases and new deaths by continent and by date.&lt;/P&gt;&lt;P&gt;What could be the code?&lt;/P&gt;</description>
    <pubDate>Tue, 01 Dec 2020 12:22:07 GMT</pubDate>
    <dc:creator>Feksan</dc:creator>
    <dc:date>2020-12-01T12:22:07Z</dc:date>
    <item>
      <title>Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702364#M37748</link>
      <description>&lt;P&gt;Hi, I have created a table that gives me two variables as you can see:&lt;/P&gt;&lt;P&gt;PROC SUMMARY data=mylib_d3.covid_data mean print;&lt;BR /&gt;VAR new_cases new_deaths;&lt;BR /&gt;BY continent date;&lt;BR /&gt;output out=mylib_d3.mean_cas_deces mean=mean_nouveaux_cas mean_nouveaux_deces;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, I want to get for each of the columns just created the minimum and the maximum with this code but it's giving me the same number for both minimums and boths maximums:&lt;/P&gt;&lt;P&gt;PROC SUMMARY data=mylib_d3.MOYENNE_CAS_DECES min max print;&lt;BR /&gt;VAR moyenne_nouveaux_cas moyenne_nouveaux_deces;&lt;BR /&gt;BY continent date;&lt;BR /&gt;output out=mylib_d3.min_max_cas_deces min=min_nouveaux_cas min_nouveaux_deces&lt;BR /&gt;max=max_nouveaux_cas max_nouveaux_deces;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What could be wrong?&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2020 23:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702364#M37748</guid>
      <dc:creator>Feksan</dc:creator>
      <dc:date>2020-11-29T23:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702369#M37750</link>
      <description>&lt;P&gt;If you use the output of the first SUMMARY as input for the second, then you only have one observation per group. It is then obvious that min=max.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that is not the case, run those two steps in one submit and post the complete log of this by copy/pasting into a window opened with the &amp;lt;/&amp;gt; button.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 00:07:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702369#M37750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-30T00:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702786#M37768</link>
      <description>&lt;P&gt;Let's say I have this data set and I want to get the minimum and maximum average of new cases and new deaths by continent and by date.&lt;/P&gt;&lt;P&gt;What could be the code?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:22:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702786#M37768</guid>
      <dc:creator>Feksan</dc:creator>
      <dc:date>2020-12-01T12:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702787#M37769</link>
      <description>&lt;P&gt;Minor variations of your PROC SUMMARY code above will work. Give it a try. If you get stuck, show us the code you have tried so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please do not provide data as attachments. The proper method to provide data is to follow &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702787#M37769</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-01T12:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702789#M37770</link>
      <description>&lt;P&gt;I have tried this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SORT data=mylib_d3.covid_data;&lt;BR /&gt;BY continent date;&lt;BR /&gt;RUN;&lt;BR /&gt;PROC SUMMARY data=mylib_d3.covid_data mean print;&lt;BR /&gt;VAR new_cases new_deaths;&lt;BR /&gt;BY continent date;&lt;BR /&gt;output out=mylib_d3.moyenne_cases_deaths mean=moyenne_new_cas moyenne_new_deces;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SUMMARY data=mylib_d3.MOYENNE_CAS_DECES min max print;&lt;BR /&gt;VAR moyenne_new_cas moyenne_new_deaths;&lt;BR /&gt;BY continent;&lt;BR /&gt;output out=mylib_d3.min_max_cas_deces min=min_new_cases min_new_deaths&lt;BR /&gt;max=max_new_cas max_new_deces;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702789#M37770</guid>
      <dc:creator>Feksan</dc:creator>
      <dc:date>2020-12-01T12:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702790#M37771</link>
      <description>&lt;P&gt;Yes, you have posted that code already and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;explained what the mistake was, but it doesn't seem as if you have fixed the mistake that he pointed out.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702790#M37771</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-01T12:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702795#M37774</link>
      <description>&lt;P&gt;Your CSV file does not contain a column "continent", so it is useless, even if I wrote code to read it.&lt;/P&gt;
&lt;P&gt;Please provide example data in a data step with datalines, use the "little running man" button to open a window for copy/pasting the code into.&lt;/P&gt;
&lt;P&gt;Next, post the code you run off&amp;nbsp;&lt;EM&gt;this particular&lt;/EM&gt; dataset; also make sure that data created in step1 is the one used in step 2, and so on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 12:57:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702795#M37774</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-01T12:57:11Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702944#M37784</link>
      <description>&lt;P&gt;This is from my log:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1 ;*';*";*/;quit;run;&lt;BR /&gt;2 OPTIONS PAGENO=MIN;&lt;BR /&gt;3 %LET _CLIENTTASKLABEL='MATH30602.A2020_Devoir3_11286690.sas';&lt;BR /&gt;4 %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';&lt;BR /&gt;5 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;6 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;7 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;8 %LET _SASPROGRAMFILE='C:\Users\admin\Desktop\Logiciels statistiques\Devoir individuel&lt;BR /&gt;8 ! 3\MATH30602.A2020_Devoir3_11286690.sas';&lt;BR /&gt;9 %LET _SASPROGRAMFILEHOST='WILLY-CLAUDE-KA';&lt;BR /&gt;10&lt;BR /&gt;11 ODS _ALL_ CLOSE;&lt;BR /&gt;12 OPTIONS DEV=SVG;&lt;BR /&gt;13 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;14 %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;16 %mend;&lt;BR /&gt;17 FILENAME EGHTML TEMP;&lt;BR /&gt;18 ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;19 OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;20 %HTML5AccessibleGraphSupported&lt;BR /&gt;21 ENCODING='utf-8'&lt;BR /&gt;22 STYLE=HtmlBlue&lt;BR /&gt;23 NOGTITLE&lt;BR /&gt;24 NOGFOOTNOTE&lt;BR /&gt;25 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;26 ;&lt;BR /&gt;NOTE: Writing HTML5(EGHTML) Body file: EGHTML&lt;BR /&gt;27&lt;BR /&gt;28 PROC SORT data=mylib_d3.covid_data;&lt;BR /&gt;29 BY continent date;&lt;BR /&gt;30 RUN;&lt;/P&gt;&lt;P&gt;NOTE: Input data set is already sorted, no sorting done.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;31 PROC SUMMARY data=mylib_d3.covid_data mean print;&lt;BR /&gt;32 VAR nouveaux_cas nouveaux_deces;&lt;BR /&gt;33 BY continent date;&lt;BR /&gt;34 output out=mylib_d3.moyenne_cas_deces mean=moyenne_nouveaux_cas moyenne_nouveaux_deces;&lt;BR /&gt;35 RUN;&lt;/P&gt;&lt;P&gt;NOTE: There were 38358 observations read from the data set MYLIB_D3.COVID_DATA.&lt;BR /&gt;NOTE: The data set MYLIB_D3.MOYENNE_CAS_DECES has 1416 observations and 6 variables.&lt;BR /&gt;NOTE: PROCEDURE SUMMARY used (Total process time):&lt;BR /&gt;real time 22.74 seconds&lt;BR /&gt;cpu time 22.68 seconds&lt;/P&gt;&lt;P&gt;36 PROC SUMMARY data=mylib_d3.MOYENNE_CAS_DECES min max print;&lt;BR /&gt;37 VAR moyenne_nouveaux_cas moyenne_nouveaux_deces date;&lt;BR /&gt;38 BY continent date;&lt;BR /&gt;39 output out=mylib_d3.min_max_cas_deces min=min_nouveaux_cas min_nouveaux_deces&lt;BR /&gt;40 max=max_nouveaux_cas max_nouveaux_deces;&lt;BR /&gt;41 RUN;&lt;BR /&gt;2 The SAS System 19:13 Tuesday, December 1, 2020&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: There were 1416 observations read from the data set MYLIB_D3.MOYENNE_CAS_DECES.&lt;BR /&gt;NOTE: The data set MYLIB_D3.MIN_MAX_CAS_DECES has 1416 observations and 8 variables.&lt;BR /&gt;NOTE: PROCEDURE SUMMARY used (Total process time):&lt;BR /&gt;real time 43.90 seconds&lt;BR /&gt;cpu time 37.34 seconds&lt;/P&gt;&lt;P&gt;42&lt;BR /&gt;43 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;44 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;45 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;46 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;47 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;48 %LET _SASPROGRAMFILE=;&lt;BR /&gt;49 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;50&lt;BR /&gt;51 ;*';*";*/;quit;run;&lt;BR /&gt;52 ODS _ALL_ CLOSE;&lt;BR /&gt;53&lt;BR /&gt;54&lt;BR /&gt;55 QUIT; RUN;&lt;BR /&gt;56&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 00:46:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702944#M37784</guid>
      <dc:creator>Feksan</dc:creator>
      <dc:date>2020-12-02T00:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702988#M37790</link>
      <description>&lt;P&gt;As I said, after the first SUMMARY,&amp;nbsp;&lt;SPAN&gt;mylib_d3.MOYENNE_CAS_DECES will have only one observation per continent and date, and so the MAX and MIN for the same BY or CLASS wiil by definition be equal. If you want to get meaningful values, calculate the MIN and MAX in the same step where you calculate the MEAN.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 07:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/702988#M37790</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-12-02T07:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Min and max functions in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/703116#M37800</link>
      <description>&lt;P&gt;So this step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY data=mylib_d3.covid_data mean print;
  BY continent date;
  VAR new_cases new_deaths;
  output out=mylib_d3.mean_cas_deces mean=mean_nouveaux_cas mean_nouveaux_deces;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will create one observation per CONTINENT DATE if you want to find the MIN/MAX of those MEAN values you will need to eliminate one of the BY variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example if you eliminate DATE from the BY statement you will get the MIN and MAX of the daily means per CONTINENT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SUMMARY data=mylib_d3.MOYENNE_CAS_DECES min max print;
  BY continent ;
  VAR moyenne_nouveaux_cas moyenne_nouveaux_deces;
  output out=mylib_d3.min_max_cas_deces
    min=min_nouveaux_cas min_nouveaux_deces
    max=max_nouveaux_cas max_nouveaux_deces
  ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 15:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Min-and-max-functions-in-SAS/m-p/703116#M37800</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-02T15:14:39Z</dc:date>
    </item>
  </channel>
</rss>

