BookmarkSubscribeRSS Feed
Deb95
Calcite | Level 5

Hi,

 

This is an URGENT REQUEST as my project is due next week!

I am a new SAS user and I am trying to build my Final Exam project but not sure how to proceed. I am a long-time Excel user and have been able to create the real-time currency exchange rate table on MS Excel and used the PROC IMPORT function to import the Excel sheet on the SAS environment. But I am getting a static table instead of the real-time one even after refreshing the output environment. 

Here are the steps I followed-

 

Step 1-

Created the real-time currency exchange rate table on MS Excel using the freely available Currency exchange rate data set on the following site:- https://www.x-rates.com/

 

Step 2- 

I uploaded the Excel sheet into my SAS folder

 

Step 3-

After that, I use the PROC IMPORT function to import the real-time dataset from the Excel sheet to the SAS environment. But the data output shows a static data table even after refreshing the environment. Not sure how to proceed please help.

 

Code used-

 

FILENAME MONEY "/home/u62057845/SAS Class Fall 2022/u62057845/Final project/currency.xlsx";
LIBNAME MONEY
PROC IMPORT OUT=money.currency
DATAFILE="/home/u62057845/SAS Class Fall 2022/u62057845/Final project/currency.xlsx"
DBMS=XLSX REPLACE;
GETNAMES=NO;
RUN;

PROC PRINT DATA=money.currency;
TITLE "Currency exchange rate from USD to other global currencies";
RUN;

-----------------------

I have attached the Excel sheet named currency with the real-time currency exchange rate data set and the code above. Please edit the file path accordingly. 

------------------------

Q2) Is there a way I can pull data sets from a website directly onto the SAS environment, instead of having to upload it into an Excel/CSV/text file first and then upload it? I know I can do it on R but not sure if SAS allows that. 

 

Please help me!! Thanks in advance. 

 

3 REPLIES 3
Reeza
Super User
If you upload an Excel file, it will always have that data. Or is the Excel file supposedly updating somehow each time it's opened?

Second method is possible, would be easier to use their API but that's likely paid.
https://blogs.sas.com/content/sasdummy/2017/12/04/scrape-web-page-data/
Deb95
Calcite | Level 5
Hi Reeza, thank you for answering my second question. I will go through the blog. And the answer to your question is- Yes, the Excel sheet updates the data every time we refresh the Excel sheet. I have used formulas that allow it to show the real-time currency rates and their conversion every 1 minute. I was wondering why I am not able to get the real-time conversion on the SAS environment when I have imported the same Excel sheet on SAS. It just prints uploads and prints the data at the time of running the codes and the rates remain static. Is there a way I can get the real-time data every time I refresh the output environment?
Reeza
Super User
Yeah, SAS will be reading the file, it will not update the values or recheck the connection. You'll need to use the second option.