<?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: To calculate values based on values present in other dataset column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/647403#M193765</link>
    <description>Just multiply 100 .&lt;BR /&gt;&lt;BR /&gt;Deviation=int(Deviation*100) ;</description>
    <pubDate>Wed, 13 May 2020 10:55:40 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2020-05-13T10:55:40Z</dc:date>
    <item>
      <title>To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645359#M192909</link>
      <description>I have a dataset with the list of givers and takers present in one column and the amount that is given (the negative values) Or taken (the positive value) by them in another column.&lt;BR /&gt;&lt;BR /&gt;The amount deviation is such that its total sum is equals to 0.&lt;BR /&gt;&lt;BR /&gt;I want to create a dataset consisting of from, amount, to as variables.&lt;BR /&gt;&lt;BR /&gt;The selection of the members should be in sequence for from and to.&lt;BR /&gt;&lt;BR /&gt;Input dataset :&lt;BR /&gt;Member Deviation&lt;BR /&gt;Aus -2000&lt;BR /&gt;Br 3000&lt;BR /&gt;Nz -10000&lt;BR /&gt;In 4000&lt;BR /&gt;No 5000&lt;BR /&gt;&lt;BR /&gt;Output dataset:&lt;BR /&gt;From Amount To&lt;BR /&gt;Aus 2000 Br&lt;BR /&gt;Nz 1000 Br&lt;BR /&gt;Nz 4000 In&lt;BR /&gt;Nz 5000 No</description>
      <pubDate>Tue, 05 May 2020 17:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645359#M192909</guid>
      <dc:creator>AnupamaMishra</dc:creator>
      <dc:date>2020-05-05T17:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645367#M192910</link>
      <description>&lt;P&gt;And how are we supposed to get the from/to for any given amount?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to provide a lot more details of the process and likely a larger example data set.&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2020 18:03:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645367#M192910</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-05T18:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645377#M192914</link>
      <description>&lt;P&gt;This looks like an optimal flow problem&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Member$ Deviation;
datalines;
Aus -2000
Br 3000
Nz -10000
In 4000
No 5000
;

/* Create every possible link, all with equal cost */
proc sql;
create table links as
select a.member as from, b.member as to, 1 as weight
from have as a inner join have as b on a.member ne b.member;
quit;

proc optnet data_links=links data_nodes=have graph_direction=directed 
	out_links=want(drop=weight rename=(from=to to=from mcf_flow=amount) where=(amount&amp;gt;0));
data_nodes_var node=member weight=deviation;
mincostflow;
run;

proc print data=want noobs; run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;to 	from 	amount
Br 	Aus 	2000
Br 	Nz 	1000
In 	Nz 	4000
No 	Nz 	5000&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 May 2020 18:53:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645377#M192914</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-05-05T18:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645527#M192998</link>
      <description>&lt;P&gt;Thank you so much for the solution&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 07:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645527#M192998</guid>
      <dc:creator>AnupamaMishra</dc:creator>
      <dc:date>2020-05-06T07:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645551#M193005</link>
      <description>&lt;P&gt;Are you processing STOCK data(buy or sell&amp;nbsp; share) ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Member$ Deviation;
datalines;
Aus -2000
Br 3000
Nz -10000
In 4000
No 5000
;
data positive;
 set have(where=(Deviation&amp;gt;0));
 do i=1 to deviation;
  output;
 end;
keep member;
run;
data negative;
 set have(where=(Deviation&amp;lt;0));
 do i=1 to -deviation;
  output;
 end;
keep member;
run;
data temp;
 merge positive negative(rename=(member=m));
 if member ne lag(member) or m ne lag(m) then group+1;
run;
proc sql;
create table want as
select group,max(m) as from,max(member) as to,count(*) as amount
 from temp
  group by group;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 May 2020 11:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/645551#M193005</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-05-06T11:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/647326#M193717</link>
      <description>&lt;P&gt;If the dataset is like below:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Member Deviation 
Aus -2000
Br 3000
Nz -10000
In 4000
No 5000
Nz -5000.56
Br 3000.56
In -2000.63
Eu 4000.63&lt;/LI-CODE&gt;&lt;P&gt;and I want output like below:&lt;/P&gt;&lt;P&gt;From&amp;nbsp; Amount To&lt;/P&gt;&lt;P&gt;Aus&amp;nbsp; &amp;nbsp;2000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Br&lt;/P&gt;&lt;P&gt;Nz&amp;nbsp; &amp;nbsp; &amp;nbsp;1000&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Br&lt;/P&gt;&lt;P&gt;Nz&amp;nbsp; &amp;nbsp; &amp;nbsp; 4000&amp;nbsp; &amp;nbsp; &amp;nbsp; In&lt;/P&gt;&lt;P&gt;Nz&amp;nbsp; &amp;nbsp; &amp;nbsp; 5000&amp;nbsp; &amp;nbsp; &amp;nbsp; No&lt;/P&gt;&lt;P&gt;Nz&amp;nbsp; &amp;nbsp; &amp;nbsp; 3000.56 Br&lt;/P&gt;&lt;P&gt;Nz&amp;nbsp; &amp;nbsp; &amp;nbsp; 2000&amp;nbsp; &amp;nbsp; &amp;nbsp; Eu&lt;/P&gt;&lt;P&gt;In&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2000.63 Eu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can we do it using retain and some loops?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2020 06:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/647326#M193717</guid>
      <dc:creator>AnupamaMishra</dc:creator>
      <dc:date>2020-05-13T06:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: To calculate values based on values present in other dataset column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/647403#M193765</link>
      <description>Just multiply 100 .&lt;BR /&gt;&lt;BR /&gt;Deviation=int(Deviation*100) ;</description>
      <pubDate>Wed, 13 May 2020 10:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/To-calculate-values-based-on-values-present-in-other-dataset/m-p/647403#M193765</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-05-13T10:55:40Z</dc:date>
    </item>
  </channel>
</rss>

