<?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: Create a new variable that finds the max of other variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116053#M259354</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... here's a variation on Linlin's idea (where there might be multiple observations with the same ID) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do until (last.id);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have (in=one) have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by id;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if one then vmax = max(vmax, of v:);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; else output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Jul 2012 19:10:27 GMT</pubDate>
    <dc:creator>MikeZdeb</dc:creator>
    <dc:date>2012-07-23T19:10:27Z</dc:date>
    <item>
      <title>Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116045#M259346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi! I have three variables, fev11, fev12, and fev13 and I need to create a new variable called fev_max that scans those three variables and finds that maximum value of the three to fill in fev_max. I need to do this by participant ID (PID). What is the best way to create this new variables. I have only ever done this using R and am not sure how to do it in SAS. Thank you in advance for any help you can give me. es&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:31:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116045#M259346</guid>
      <dc:creator>rfarmenta</dc:creator>
      <dc:date>2012-07-23T18:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116046#M259347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about using:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fev_max=LARGEST(1, fev11, fev12, fev13);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fev_max=MAX(fev11, fev12, fev13);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116046#M259347</guid>
      <dc:creator>robby_beum</dc:creator>
      <dc:date>2012-07-23T18:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116047#M259348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can a participant have more than one record, ie more than one line in the dataset?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116047#M259348</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-07-23T18:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116048#M259349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;BR /&gt;input id v1-v3;&lt;BR /&gt;cards;&lt;BR /&gt;1 20 21 19&lt;BR /&gt;1 30 32 39&lt;BR /&gt;2 15 18 13&lt;BR /&gt;;&lt;BR /&gt;data temp;&lt;BR /&gt; set have;&lt;BR /&gt; max=largest(1,of v1-v3);&lt;BR /&gt;proc sort;&lt;BR /&gt;by id descending max;&lt;/P&gt;&lt;P&gt;data want(drop=max);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; retain fev_max;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; set temp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; by id;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; fev_max=ifn(first.id=1,max,fev_max); &lt;BR /&gt; proc print;&lt;BR /&gt; run;&lt;BR /&gt; Obs&amp;nbsp;&amp;nbsp;&amp;nbsp; fev_max&amp;nbsp;&amp;nbsp;&amp;nbsp; id&amp;nbsp;&amp;nbsp;&amp;nbsp; v1&amp;nbsp;&amp;nbsp;&amp;nbsp; v2&amp;nbsp;&amp;nbsp;&amp;nbsp; v3&lt;/P&gt;&lt;P&gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 30&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 39&lt;BR /&gt; 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 39&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&lt;BR /&gt; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116048#M259349</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-23T18:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116049#M259350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That worked, thank you! I have never used the MAX or LARGEST functions in SAS so I did not know they existed! Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:50:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116049#M259350</guid>
      <dc:creator>rfarmenta</dc:creator>
      <dc:date>2012-07-23T18:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116050#M259351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A really helpful book to get as you build your SAS library is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"SAS Functions by Example" By Ron Cody.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great functions and their usage in this book!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:53:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116050#M259351</guid>
      <dc:creator>robby_beum</dc:creator>
      <dc:date>2012-07-23T18:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116051#M259352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robby,&lt;/P&gt;&lt;P&gt;I like your original photo. Why did you make the change?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 18:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116051#M259352</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2012-07-23T18:57:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116052#M259353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HA! - I was just sitting around, had a few minutes on my hands and thought "why not change my picture!" &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 19:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116052#M259353</guid>
      <dc:creator>robby_beum</dc:creator>
      <dc:date>2012-07-23T19:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116053#M259354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ... here's a variation on Linlin's idea (where there might be multiple observations with the same ID) ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;data want;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;do until (last.id);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have (in=one) have;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; by id;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if one then vmax = max(vmax, of v:);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;&amp;nbsp; else output;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;end;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: 'courier new', courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 19:10:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116053#M259354</guid>
      <dc:creator>MikeZdeb</dc:creator>
      <dc:date>2012-07-23T19:10:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new variable that finds the max of other variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116054#M259355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the book suggestion, I will look into purchasing it. Thank you everyone again for the code. These forums are a great place for people like me who still have a lot to learn about SAS and I appreciate being able to come here to get help! &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2012 19:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-new-variable-that-finds-the-max-of-other-variables/m-p/116054#M259355</guid>
      <dc:creator>rfarmenta</dc:creator>
      <dc:date>2012-07-23T19:28:13Z</dc:date>
    </item>
  </channel>
</rss>

