While getting coffee at work, I came across this interesting little problem. The coffee machine gives us two size options - 'Regular' and 'Medium'. I know one option fills my cup, the other option causes it to overflow. My dilemma is choosing the correct option, so my cup doesn't overflow. Of the two options, does Regular imply the larger size and Medium the smaller size? Or does Regular imply the smaller size? I have no way to tell.
If either of the two words were substituted by 'Small' or 'Large', I would have known which option to choose. For example, Between Large and Regular, I know the large size would provide more coffee. Similarly, if I had to choose between Regular and Small, I would assume Regular would provide more coffee than Small. The same reasoning applies for Large/Medium or Medium/Small. Of all the permutations using the four words (i.e., Large, Medium, Small and Regular), the coffee machine provides the only combination that makes it impossible to figure out the dispensing amount. By the way, for this particular coffee machine, I found out that Regular is larger than Medium.
Wednesday, November 25, 2009
Saturday, April 4, 2009
Retrieving Data From A Website Into Excel
In this post, I'll show you how to query data from a website using Microsoft Excel. In this example, we will be extracting the stock quote and relevant information for Macy (NYSE:M) from the Yahoo! finance page. First, launch Excel. From the Data taskbar, select Import -> External Data -> New Web Query.
The web query will open a window. In the address section (look for the first red circle), type in the web address. Here I typed in "http://finance.yahoo.com/q?s=M", which is the address for looking up the stock quote for Macy's in Yahoo! finance. Click on Import (the second red circle).
Excel will give you the option to output the data in the existing spreadsheet or a new spreadsheet. Make your choice and click on OK.
Now you should have the data in your Excel spreadsheet. You can analyze the data as you wish.
You can save this entire process in a macro, and launch it with the press of a button. Depending on how you design your macro, you can kick off the process everyday and get the most current information.
You can even have SAS kick off this macro, and read in the data from the Excel spreadsheet. Using this method, you can write a SAS program - maybe to analyze a particular stock - which can pull data from a finance website for that stock. Please see my post on August 27, 2008 (Tools of the Trade V: Kicking Excel VBA Macros From SAS) on how to launch Excel macros from SAS, and see my post on December 29, 2007 (Tools of the Trade II: Using SAS to Extract the Data) on how to read in data from Excel into your SAS program.
The web query will open a window. In the address section (look for the first red circle), type in the web address. Here I typed in "http://finance.yahoo.com/q?s=M", which is the address for looking up the stock quote for Macy's in Yahoo! finance. Click on Import (the second red circle).
Excel will give you the option to output the data in the existing spreadsheet or a new spreadsheet. Make your choice and click on OK.
Now you should have the data in your Excel spreadsheet. You can analyze the data as you wish.
You can save this entire process in a macro, and launch it with the press of a button. Depending on how you design your macro, you can kick off the process everyday and get the most current information.
You can even have SAS kick off this macro, and read in the data from the Excel spreadsheet. Using this method, you can write a SAS program - maybe to analyze a particular stock - which can pull data from a finance website for that stock. Please see my post on August 27, 2008 (Tools of the Trade V: Kicking Excel VBA Macros From SAS) on how to launch Excel macros from SAS, and see my post on December 29, 2007 (Tools of the Trade II: Using SAS to Extract the Data) on how to read in data from Excel into your SAS program.
Subscribe to:
Posts (Atom)