<?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: How to separate positive and negative values in SAS ??? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627840#M185422</link>
    <description>&lt;P&gt;Do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
input id amt;
datalines;
1 40
3 20
4 -10
5 -30
2 50
6 -20
;
run;

data want;
    set ds;
    if amt &amp;gt;= 0 then pos=amt;
    else             neg=amt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;id  amt  pos  neg 
1   40   40   . 
3   20   20   . 
4   -10  .    -10 
5   -30  .    -30 
2   50   50   . 
6   -20  .    -20 
&lt;/PRE&gt;</description>
    <pubDate>Thu, 27 Feb 2020 10:30:04 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-02-27T10:30:04Z</dc:date>
    <item>
      <title>How to separate positive and negative values in SAS ???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627836#M185421</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;I have dataset like below....



data ds;

input id amt;

datalines;

1 40

3 20

4 -10

5 -30

2 50

6 -20

;

run;


Through this dataset i want to create output dataset have two new variables and one variable contains positive values only and another variable have negative values only...

If anyone knows please write a programme ....&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627836#M185421</guid>
      <dc:creator>Mohan_Reddy</dc:creator>
      <dc:date>2020-02-27T10:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate positive and negative values in SAS ???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627840#M185422</link>
      <description>&lt;P&gt;Do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
input id amt;
datalines;
1 40
3 20
4 -10
5 -30
2 50
6 -20
;
run;

data want;
    set ds;
    if amt &amp;gt;= 0 then pos=amt;
    else             neg=amt;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;id  amt  pos  neg 
1   40   40   . 
3   20   20   . 
4   -10  .    -10 
5   -30  .    -30 
2   50   50   . 
6   -20  .    -20 
&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:30:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627840#M185422</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-27T10:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate positive and negative values in SAS ???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627842#M185423</link>
      <description>But in that new variables blank place we want zero's please modify that programme</description>
      <pubDate>Thu, 27 Feb 2020 10:30:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627842#M185423</guid>
      <dc:creator>Mohan_Reddy</dc:creator>
      <dc:date>2020-02-27T10:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to separate positive and negative values in SAS ???</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627843#M185424</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set ds;
    pos=0; neg=0;
    if amt &amp;gt;= 0 then pos=amt;
    else             neg=amt;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Feb 2020 10:32:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-separate-positive-and-negative-values-in-SAS/m-p/627843#M185424</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-02-27T10:32:33Z</dc:date>
    </item>
  </channel>
</rss>

