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. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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