<?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 Create New Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711204#M219039</link>
    <description>&lt;P&gt;Hi....I am trying to create the variable Final from the Decision variable. For each ID and Color group, if there is 'Yes' in the group, then Final is 'Yes' for the last row in the group and all other entries for Final is 'No'. Any suggestions on the best way to do this...Thanks&lt;/P&gt;
&lt;PRE&gt;data Have;
    format ID best12. Color $char6. Part $char1. Decision $char3. Final $char3.;
	input ID : best32. Color : $char6. Part : $char1. Decision : $char3. Final : $char3.;
cards;
1 Yellow A Yes No
1 Yellow B No No
1 Yellow C No Yes
2 Blue A No No
2 Blue B Yes No
2 Blue C No Yes
3 Red A No No
3 Red B No No
3 Red C Yes Yes
4 Orange A Yes No
4 Orange B No Yes
5 Green B No No
5 Green C Yes Yes
6 Red A No No
6 Red C No No
;&lt;/PRE&gt;</description>
    <pubDate>Wed, 13 Jan 2021 16:55:20 GMT</pubDate>
    <dc:creator>twildone</dc:creator>
    <dc:date>2021-01-13T16:55:20Z</dc:date>
    <item>
      <title>Create New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711204#M219039</link>
      <description>&lt;P&gt;Hi....I am trying to create the variable Final from the Decision variable. For each ID and Color group, if there is 'Yes' in the group, then Final is 'Yes' for the last row in the group and all other entries for Final is 'No'. Any suggestions on the best way to do this...Thanks&lt;/P&gt;
&lt;PRE&gt;data Have;
    format ID best12. Color $char6. Part $char1. Decision $char3. Final $char3.;
	input ID : best32. Color : $char6. Part : $char1. Decision : $char3. Final : $char3.;
cards;
1 Yellow A Yes No
1 Yellow B No No
1 Yellow C No Yes
2 Blue A No No
2 Blue B Yes No
2 Blue C No Yes
3 Red A No No
3 Red B No No
3 Red C Yes Yes
4 Orange A Yes No
4 Orange B No Yes
5 Green B No No
5 Green C Yes Yes
6 Red A No No
6 Red C No No
;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2021 16:55:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711204#M219039</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2021-01-13T16:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711210#M219041</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    by id color;
    length final $ 3;
    retain flag;
    if first.color then flag=0;
    if decision='Yes' then flag=1;
    if not last.color or (last.color and flag=0) then final='No';
    else if last.color and flag=1 then final='Yes';
    drop flag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Jan 2021 17:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711210#M219041</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-01-13T17:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create New Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711214#M219045</link>
      <description>Thanks Paige!!!</description>
      <pubDate>Wed, 13 Jan 2021 17:13:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-New-Variable/m-p/711214#M219045</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2021-01-13T17:13:08Z</dc:date>
    </item>
  </channel>
</rss>

