0

Table from SAS

In this table, the Trans_Date column continues up to 31/07/2016.

How do I multiply the Value column to the Rate column (currency exchange for AUD in terms of NZD, CAD, GBP as seen in currency_conv for a particular date) under a loop to display the Value of each Order_Number only in AUD?

The Currency column should only be in terms AUD.

metaGross
  • 15
  • 1
  • 1
  • 6
  • Pictures of data aren't helpful. Please put the sample data in the text of your question, as well as desired output, and what code you have tried. Is your question really, "how do I multiply two variables in SAS?" The answer is var1*var2. But I would look for some basic online tutorials and documentation. http://support.sas.com/documentation/cdl/en/basess/68381/HTML/default/viewer.htm#p0i1iathn4xb1un1j4kg927qrblj.htm – Quentin Jun 03 '17 at 10:43

1 Answers1

0

Are you asking take the AUD conversion rate for each day for each currency and multiply each entry accordingly?

For that you might try the following:

First, create a new table:

proc sql noprint;
create table rates as
select * from table
where Currency = 'AUD'
order by Trans_date;
quit;

data rates;
set rates;
by Trans_date;
output;
if last.Trans_date then do;
  currency_conv = 'AUD';
  rate = 1.;
  output;
end;
run;

now join tables:

proc sql noprint;
create table as newTable
select a.*,a.value*b.rate as newValue
from table as a
left join (select * from rates) as b
on a.Trans_date = b.Trans_date
and a.currency = b.currency_conv;
quit;
DCR
  • 14,737
  • 12
  • 52
  • 115