<?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: Data Set Manipulation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283664#M57805</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the below sql code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select id,aptype, case when count(distinct aptype)&amp;gt;1 then "present" else pay end as pay format=$15. from have&lt;BR /&gt;group by id;&lt;BR /&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jul 2016 03:28:24 GMT</pubDate>
    <dc:creator>stat_sas</dc:creator>
    <dc:date>2016-07-12T03:28:24Z</dc:date>
    <item>
      <title>Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283652#M57796</link>
      <description>&lt;P&gt;Hey SASers!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to create a simple derive to a variable but not sure how to create it. Maybe using a when or select when statement...&lt;/P&gt;
&lt;P&gt;I want SAS to check when a value Filled and Acting to change the pay from Leave to Present such that when variable name APtype is filled and acting for the same person id then their pay should change to present. Note the person can be in the dataset twice. See attached example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 01:24:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283652#M57796</guid>
      <dc:creator>Geeman</dc:creator>
      <dc:date>2016-07-12T01:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283664#M57805</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try the below sql code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table want as&lt;BR /&gt;select id,aptype, case when count(distinct aptype)&amp;gt;1 then "present" else pay end as pay format=$15. from have&lt;BR /&gt;group by id;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 03:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283664#M57805</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-07-12T03:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283665#M57806</link>
      <description>&lt;P&gt;You'd better post data in this forum , not attaching a file.Nobody would like to download the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards expandtabs truncover;
input id	(aptype	pay) (:$20.);
cards;
123	filled	leave
123	acting	present
456	filled	present
789	filled	leave
474	filled	leave
474	acting	present
212	filled	suspended
287	assingment	present
;
run;
data want;
 merge have have(keep=id pay rename=(id=_id pay=_pay) firstobs=2);
 if id=_id and pay='leave' and _pay='present' then pay='present';
drop _:;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jul 2016 03:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283665#M57806</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-12T03:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283776#M57844</link>
      <description>Thanks for this Ksharp. Still not working.  Merge and Rename working correctly.</description>
      <pubDate>Tue, 12 Jul 2016 14:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283776#M57844</guid>
      <dc:creator>Geeman</dc:creator>
      <dc:date>2016-07-12T14:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283794#M57852</link>
      <description>&lt;P&gt;For "not working" please provide how is is not working: no output, wrong output, unexpected output. Provide example of the input, the expeceted or desired output and the actual output, and helps to be very explicit in referencing values. Also it may help to post the log of the code run in case of typos in the code or other syntax issues.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 15:15:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283794#M57852</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-12T15:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Data Set Manipulation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283931#M57905</link>
      <description>&lt;P&gt;thanks!! worked great! very much appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 00:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Set-Manipulation/m-p/283931#M57905</guid>
      <dc:creator>Geeman</dc:creator>
      <dc:date>2016-07-13T00:54:09Z</dc:date>
    </item>
  </channel>
</rss>

