BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SASdevAnneMarie
Barite | Level 11

Hello Experts,

 

You know that in web, there is the request (the client's request -> server) and the response (server -> client's browser). The response from http://XXXXXX is a file stream type txt (generated with php).

 

So physical file doesn't exist, while clicking on  http://XXXXXX

 

I'm wondering if there is possible to import this kind of file ? 

 

Thank you for helping !

1 ACCEPTED SOLUTION

Accepted Solutions
japelin
Rhodochrosite | Level 12

If you use SAS 9.4(M3 and later), you can use proc http.

Try this code.

 

filename webdoc 'c:/temp/want.txt' encoding='utf-8';  
proc http  
 method="get"  
 url="https://www.google.com/"  
 out=webdoc;  
run;  
  
data test;  
 infile webdoc;  
 attrib buf length=$4096;  
 input buf $4096.;  
 put buf=;  
run;  

 

you can get 'c:/temp/want.txt' as a text file, and 'WORK.TEST' as a dataset.

 

View solution in original post

2 REPLIES 2
japelin
Rhodochrosite | Level 12

If you use SAS 9.4(M3 and later), you can use proc http.

Try this code.

 

filename webdoc 'c:/temp/want.txt' encoding='utf-8';  
proc http  
 method="get"  
 url="https://www.google.com/"  
 out=webdoc;  
run;  
  
data test;  
 infile webdoc;  
 attrib buf length=$4096;  
 input buf $4096.;  
 put buf=;  
run;  

 

you can get 'c:/temp/want.txt' as a text file, and 'WORK.TEST' as a dataset.

 

SASdevAnneMarie
Barite | Level 11
Thank you, Kawakami !
That works !
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
  • 2 replies
  • 916 views
  • 1 like
  • 2 in conversation