The code below only loads 43 lines of the web-site data to scrape.
filename output temp; * Setup a scratch file ;
%Let sub = Airport%20West;
proc http url="http://reiv.com.au/market-insights/suburb/&sub" method="get"
out=output;
run;
*
Create a data set called first with one variable for the contents of the
webpage called value
;
data first;
length suburb $ 20;
suburb = "&sub";
suburb = tranwrd(suburb, "%20", " ");
length value $30000;
infile output _infile_ = line;
input @1 value $30000.;
linenum = _n_;
output;
label
value = webpage code
suburb = "Name of suburb with %20 replaced by space"
linenum = Line number of code;
run;
How do I get it to set aside sufficient space for up to 1000 lines of code from this website?
Thanks, Joe
You get the whole HTML content (the last observation contains the </html> tag), and it seems what you get is a script supposed to actually fetch the data, something I don't know if it's doable with PROC HTTP.
After trying the URL in Safari, you first get one of those "I am not a robot" pages, and after verification are routed to the actual data.
You should get in touch with the operators of the website, if they provide a dedicated download method for their data.
@jhirschb wrote:
This is not the case when using SAS on machines that have it installed.
Once you visited the page "manually" from such a computer, the "I am not a robot" script is circumvented because the necessary cookie is present.
Visit the page from your PC, save the HTML, then upload it to On Demand, so you can play around with it there.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.