tag:blogger.com,1999:blog-8284704396680106111.post6407512000074263727..comments2023-12-13T04:47:26.807-08:00Comments on SASopedia: Reading a table from a website into a SAS datasetPramod Rhttp://www.blogger.com/profile/08273269291349496109noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-8284704396680106111.post-388337415271467922011-03-30T00:35:34.681-07:002011-03-30T00:35:34.681-07:00Hi Chris,
Using the compress function would defin...Hi Chris,<br /><br />Using the compress function would definitely help in parsing the html codes...<br /><br />I also realized later that i could even parse this using the xml engine in SAS as expained here:<br />http://support.sas.com/rnd/base/xmlengine/sxle91/xmlprocess.html<br /><br />However, we may not be lucky always to get a 'well constructed' html page to employ this method for parsing...Pramod Rhttps://www.blogger.com/profile/08273269291349496109noreply@blogger.comtag:blogger.com,1999:blog-8284704396680106111.post-90282472353026872492011-03-29T05:46:01.930-07:002011-03-29T05:46:01.930-07:00The compress function has a third argument, which ...The compress function has a third argument, which can be used to add a list of characters to the second argument. I think 'a' specifies all alphabet characters (upper and lower), so perhaps that would shorten your code. Take a look at the other modifiers for more useful characters.<br /><br />http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212246.htmChrishttps://www.blogger.com/profile/07166882146358179182noreply@blogger.comtag:blogger.com,1999:blog-8284704396680106111.post-44303944570171918762011-02-22T18:09:00.976-08:002011-02-22T18:09:00.976-08:00Arun,
It would always be the best to copy paste t...Arun,<br /><br />It would always be the best to copy paste the table from the browser to the excel sheet.. The above method would come handy only when you need to do this on a regular basis.. so that you can automate the code.. <br />However, you may need to be sure that the format of the html which is being rendered has to be consistent always... Otherwise our parsing mechanism goes for a toss..<br />You may also want to explore the libname xml method for parsing the html files as explained here: http://support.sas.com/rnd/base/xmlengine/sxle913/usersguide913.htm<br /><br />Thanks for your encouraging words.. This truly motivates me to write better!Pramod Rhttps://www.blogger.com/profile/08273269291349496109noreply@blogger.comtag:blogger.com,1999:blog-8284704396680106111.post-62918087823360915182011-02-22T00:26:08.610-08:002011-02-22T00:26:08.610-08:00Well, apart from connecting directly to the URL fr...Well, apart from connecting directly to the URL from SAS, the rest of the procedure is quite intensive! I hadn't known about the @class types.<br /><br />Wouldn't it just be easier to copy it into Excel and upload??! :)<br /><br />Nice post, and I think I'm going to be following this from now on.<br /><br />Thanks,<br />Arun (ex-colleague)Anonymousnoreply@blogger.com