BookmarkSubscribeRSS Feed
saswiki
Obsidian | Level 7

Hi Experts, 

 

I am stuck with the logic where i need to automate reading the txt files from sharepoint. The requirement is to pull all the txt files which are available in the Sharepoint folder. I am able to copy and read the files one by one but i need to automate this process. Your idea/suggestions would really help me. 

 

Here is the code for reading one file : 

 

filename outfile "/sasdata/MCS_Change_Notice.txt";

 

PROC HTTP
URL="https://xxxx.sharepoint.com/teams/xxxx/_api/Web/getfilebyserverrelativeurl('/teams/xxxx/Shared%20Doc..."
METHOD="GET" OUT=OUTFILE;
HEADERS
"Authorization"="Bearer &access_token."
"X-RequestDigest"="form digest value"
;
RUN;

 

DATA _Read;
infile "/sasdata/MCS_Change_Notice.txt" truncover delimiter='^' dsd ;
input stuff $5000.;
run;

 

Do we have any method to pull the complete files under sharepoint folder?

 

Let me know if any additional details required. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 0 replies
  • 408 views
  • 0 likes
  • 1 in conversation