10-20-2014 01:45 PM
I am a newbie in SAS programming. I was wondering if it is possible to open a SAS file in a macro and use its variables to do some calculations?
to be more specific, I am trying to write a macro for changing currencies to AUD but not the current rates to get it from a live data source rather I need historical rates. So I have the historical exchange rates downloaded from Reserve bank of Australia and already imported to SAS. But have not yet figured out how to write a macro to open the file and use its values. Something that I have tried is the following:
%IF exchange_rates.date=&date %then Rate=&CUR;
I will be thankful if someone can help.
10-20-2014 02:46 PM
If by SAS file you mean a SAS dataset then I suggest you use a SAS DATA step for that. BTW the FOPEN function is for external files, usually text, and not SAS datasets.
To start with just build a simple DATA step without using a macro, then once that is working, convert it to a macro:
currency_aud = currency * rate;