<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:georss='http://www.georss.org/georss' xmlns:thr='http://purl.org/syndication/thread/1.0' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/&quot;CkAHRnc5fyp7ImA9WhRTEk0.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063</id><updated>2011-11-01T19:25:37.927-07:00</updated><category term='Stata'/><category term='plot'/><category term='excel'/><category term='splitting'/><category term='Graphics'/><category term='emf'/><category term='Better Graphics'/><category term='concatenation'/><category term='function'/><category term='Inkscape'/><category term='graph'/><category term='Vector'/><category term='Raster'/><title>Gridscape</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gridscape.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default?redirect=false&amp;v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry gd:etag='W/&quot;CkAHQHcyeSp7ImA9WhRTEk0.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-8480991241654987502</id><published>2011-11-01T19:23:00.000-07:00</published><updated>2011-11-01T19:25:31.991-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-11-01T19:25:31.991-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Stata'/><title>10 Things every Beginner should know about Stata</title><content type='html'>&lt;div&gt;
When I first started working with Stata my&amp;nbsp;initial&amp;nbsp;impression was that it was ugly, and overwhelming.&amp;nbsp;&amp;nbsp;I was confused as to why you would want to type in commands rather than point and click (this became painfully obvious over time).&amp;nbsp;This was a product of a transition from Microsoft Excel. Of course, the two programs while sharing some functionality are hardly comparable.&lt;br /&gt;
&lt;br /&gt;
What I have come to find is that Stata is built for speed, does things that are impossible in Microsoft Excel, can produce beautiful graphics (see this), and its easy to find help.&lt;br /&gt;
&lt;br /&gt;
I should mention that I did not learn Stata starting from page one of the manual. Rather, I picked it up as I went along, through google searches, and using #1 from below.&lt;br /&gt;
&lt;br /&gt;
I am by no means an expert - but having worked with Stata for over a year now I believe I've found a few things that I wish I could have discovered on my first day using Stata. Hopefully if your a beginner or intermediate Stata user, you'll find this list to be helpful!&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Type&amp;nbsp;&lt;b&gt;help&lt;/b&gt;&amp;nbsp;followed by a command and Stata will bring up a help file or do a keyword search. For example, try typing in&amp;nbsp;&lt;b&gt;help correlate&lt;/b&gt;.&amp;nbsp;This makes learning Stata easy and referencing proper usage of commands easier than using dialogues at times.&lt;/li&gt;
&lt;li&gt;Stata is extensible. Type&amp;nbsp;&lt;b&gt;findit&lt;/b&gt;&amp;nbsp;and Stata will search repositories for programs. There are programs for everything from&amp;nbsp;&lt;a href="http://ideas.repec.org/c/boc/bocode/s456836.html"&gt;reversing the order of labels&lt;/a&gt;&amp;nbsp;to&amp;nbsp;&lt;a href="http://ideas.repec.org/c/boc/bocode/s456416.html"&gt;producing a latex table of regression output&lt;/a&gt;.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Do Files&lt;/b&gt;: These are text files ending with the .do extension. that are nothing generally contain a list of commands and comments you create. You can use them to keep track of what you have done to a dataset (by successively adding newly typed commands), or create scripts for repetitive tasks. &lt;a href="http://www.ssc.wisc.edu/sscc/pubs/sfr-dofiles.htm"&gt;Read more &amp;gt;&amp;gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;When I first started many of my struggles were in getting Stata to do something that was trivial in excel. For instance sorting in reverse alphabetical order (see gsort) or splitting city-state references (see split). The following are a few of the data manipulation commands that I use often. Use&amp;nbsp;&lt;b&gt;help&lt;/b&gt;&amp;nbsp;to find out more if you don't know about one already.&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;sort&lt;/li&gt;
&lt;li&gt;gsort&lt;/li&gt;
&lt;li&gt;order&lt;/li&gt;
&lt;li&gt;split&lt;/li&gt;
&lt;li&gt;drop&lt;/li&gt;
&lt;li&gt;generate&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;&lt;b&gt;Snapshots&lt;/b&gt;: In Stata (version +) you can save snapshots of your data. Unlike a program like Microsoft Excel, Stata doesn't include an undo button. Snapshots allow you to save your data at particular stages to return to in case you screw something up. For instance, I often create a snapshot prior to merging two datasets in case a merge doesn't work. Snapshots can be created using the command &lt;a href="http://www.stata.com/help.cgi?snapshot"&gt;snapshot&lt;/a&gt;&amp;nbsp;or in more recent versions there is a tab on the lefthand side of the data editor for creating them.&lt;/li&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-waYdDkBQjPw/TrCk7tNxMaI/AAAAAAAACD8/GPaXj9jl9IQ/s1600/data_editor_paste_special.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="219" src="http://1.bp.blogspot.com/-waYdDkBQjPw/TrCk7tNxMaI/AAAAAAAACD8/GPaXj9jl9IQ/s320/data_editor_paste_special.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Snapshots can be created using the 'snapshot' tab on the lefthand side.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;li&gt;&lt;b&gt;_n&lt;/b&gt;, and&amp;nbsp;&lt;b&gt;_N: &lt;/b&gt;These are &lt;a href="http://www.stata.com/help.cgi?_variables"&gt;system variables&lt;/a&gt;.&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;b&gt;_n&amp;nbsp;&lt;/b&gt;is a variable for the current observation (row) being worked with. If you were to type generate newvar = _n, you would get a variable numbed 1 through the number of rows you have.&amp;nbsp;&lt;b&gt;_N&amp;nbsp;&lt;/b&gt;is a variable for the total number of rows in your dataset.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Subscripting: &lt;/b&gt;This allows you to reference individual elements or observations of a variable. For instance, typing display var[3] will return the value of &lt;i&gt;var&lt;/i&gt;&amp;nbsp;found in the third row. &lt;a href="http://www.stata.com/help.cgi?subscripting"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Macros&lt;/b&gt;: Macros are bits of data that can be saved and reused. For instance, macros allow you to temporary create variables, retrieve labels, incorporate them into commands, or they can be used as variables. &lt;a href="http://www.stata.com/help.cgi?macro"&gt;Read More&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Return List&lt;/b&gt;: If you use Statas built in commands it won't always output everything your looking for or a truncated p-value. You can retrieve more accurate numbers by typing&amp;nbsp;&lt;b&gt;return list&lt;/b&gt;&amp;nbsp;following a command to see what data Stata makes available. &lt;a href="http://www.stata.com/help.cgi?return"&gt;Read More &amp;gt;&amp;gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Loops and branching&lt;/b&gt;: You can use if, while, and looping statements in Stata to automate all kinds of tasks in Stata. See the following for more:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.stata.com/help.cgi?forvalues"&gt;forvalues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.stata.com/help.cgi?foreach"&gt;foreach&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.ssc.wisc.edu/sscc/pubs/stata_prog2.htm#BranchingIf"&gt;branching&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ol&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-8480991241654987502?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/8480991241654987502?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/8480991241654987502?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/11/10-things-every-beginner-should-know.html' title='10 Things every Beginner should know about Stata'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-waYdDkBQjPw/TrCk7tNxMaI/AAAAAAAACD8/GPaXj9jl9IQ/s72-c/data_editor_paste_special.png' height='72' width='72'/></entry><entry gd:etag='W/&quot;CEABQnY8cSp7ImA9WhRTEE4.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-3512218778503278647</id><published>2011-10-31T00:30:00.000-07:00</published><updated>2011-10-30T20:45:53.879-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-10-30T20:45:53.879-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='splitting'/><title>Splitting first and last names in Microsoft Excel</title><content type='html'>&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;Mary Post Rogers&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=LEFT(A1,SEARCH(" ",A1))&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=RIGHT(A1,LEN(A1) - SEARCH(" ",A1))&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;Peter Van Der Groff&lt;/td&gt;
&lt;td&gt;Peter&lt;/td&gt;
&lt;td&gt;Van Der Groff&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
If you are working with excel and are given a list of names - splitting them into first and last can present problems when people have multi-word last names or first names (example: James Van Der Beek). &lt;br /&gt;
Its not possible to catch all of these - so you should hand check your data, but you can split single word first names and multi-word last names using the formulas above. The formulas in the first row will identify a first name and multi-word last name in addition to single word first and last name individuals.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-3512218778503278647?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/3512218778503278647?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/3512218778503278647?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/10/splitting-last-and-first-names-in.html' title='Splitting first and last names in Microsoft Excel'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author></entry><entry gd:etag='W/&quot;CkIDSXo_eyp7ImA9WhRTEUo.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-2553298648022904235</id><published>2011-10-30T11:43:00.000-07:00</published><updated>2011-11-01T11:02:58.443-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-11-01T11:02:58.443-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='splitting'/><title>Splitting City-State in Excel</title><content type='html'>If you have data in the following format:&lt;br /&gt;
&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;Cedar Rapids, IA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;Des Moines, IA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;3&lt;/td&gt;
&lt;td&gt;San Diego, CA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;4&lt;/td&gt;
&lt;td&gt;Chicago, IL&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
You can split the city and state by taking advantage of the comma that has been placed in between the two. You can use &lt;b&gt;Text to Columns&lt;/b&gt;.
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Select the entire column A (click the A). &lt;/li&gt;
&lt;li&gt;Navigate to &lt;b&gt;Data&lt;/b&gt; &amp;gt; &lt;b&gt;Text-to-Columns&lt;/b&gt;. This will open a dialogue box. Select the &lt;b&gt;Delimited&lt;/b&gt; option and click next.&lt;/li&gt;
&lt;li&gt;The next step allows you to select a delimiter. The delimiter is a character used to separate data. In our case it is a comma. Select &lt;b&gt;Comma&lt;/b&gt; as your delimiter.&lt;/li&gt;
&lt;li&gt;You should see a preview of the data below within the wizard. Note that Text to Columns will replace adjacent columns so you should be sure to add columns prior to doing so to prevent the contents of adjacent (in this case, column B) contents from being replaced. Click &lt;b&gt;Next&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;For our purposes, the final step of the wizard is unimportant. You can click &lt;b&gt;Finish&lt;/b&gt; to complete the operation.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;

What if City and State aren't separated by a comma?&lt;/h3&gt;
It is still possible to separate City and State even if they aren't separated by a delimiter. You can use the &lt;b&gt;left()&lt;/b&gt;, &lt;b&gt;Len()&lt;/b&gt; and &lt;b&gt;right()&lt;/b&gt; functions.&lt;br /&gt;
&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;Cedar Rapids IA&lt;/td&gt;
&lt;td&gt;Cedar Rapids&lt;/td&gt;
&lt;td&gt;IA&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;Cedar Rapids IA&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=LEFT(A2,LEN(A2)-3)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=RIGHT(A2,2)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The &lt;b&gt;Left()&lt;/b&gt; and &lt;b&gt;Right()&lt;/b&gt; functions take the leftward and rightward characters specified. For example, &lt;code&gt;=Right(A2, 2)&lt;/code&gt; is telling Excel to grab the two rightmost characters from cell &lt;b&gt;A2&lt;/b&gt;, which in this case is "Cedar Rapids IA". This function can be used to grab all of the state abbreviations.&lt;br /&gt;
What about making a column for just the cities? The key to this is realizing that there are 3 characters following each City in column &lt;b&gt;A&lt;/b&gt;: A space and the two letters in a state abbreviation.&lt;br /&gt;
Because of this we can use the &lt;b&gt;Len()&lt;/b&gt; function to count the number of characters in column A and subtract three from it. Then we can use &lt;b&gt;Left&lt;/b&gt; to grab this many leftward characters. This is the formula you see in &lt;b&gt;B2&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-2553298648022904235?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/2553298648022904235?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/2553298648022904235?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/10/often-times-you-may-find-yourself.html' title='Splitting City-State in Excel'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author></entry><entry gd:etag='W/&quot;DU4CRXo-eyp7ImA9WhRTEE0.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-1240235243604898436</id><published>2011-10-29T13:37:00.000-07:00</published><updated>2011-10-30T13:52:44.453-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-10-30T13:52:44.453-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='splitting'/><title>Splitting a telephone number in Microsoft Excel</title><content type='html'>&lt;p&gt;If you have a list of telephone numbers formatted rather messily, you can split the telephone numbers into area code + local number using &lt;strong&gt;Find &amp; Replace&lt;/strong&gt;, &lt;strong&gt;Left()&lt;/strong&gt;, &lt;strong&gt;Mid()&lt;/strong&gt;, and &lt;strong&gt;Right()&lt;/strong&gt;.&lt;/p&gt;

&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;D&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;(555)-767-9000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;888-487-8000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;3&lt;/td&gt;
&lt;td&gt;9994879000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;The first step is to remove all of the extra characters so all your phone numbers do not include any additional characters. Use &lt;strong&gt;Find and Replace&lt;/strong&gt; to remove the parentheses and dashes.
&lt;ol&gt;
&lt;li&gt;Select Column &lt;strong&gt;A&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Ctrl+F&lt;/strong&gt; to open the find and replace dialogue.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Find what:&lt;/strong&gt; your going to enter each character you see in your phone numbers, one at a time. In our example, it would be: &lt;strong&gt;( ) - &lt;/strong&gt;. Under &lt;strong&gt;Replace with:&lt;/strong&gt; you enter nothing.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You should be left with data that looks like this:&lt;/p&gt;

&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;D&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;5557679000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;8884878000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;3&lt;/td&gt;
&lt;td&gt;9994879000&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;Now you can use the left(), right(), and mid() functions to extract each portion of the telephone number into its own column.&lt;/p&gt;

&lt;table class="excel"&gt;
&lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;D&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;1&lt;/td&gt;
&lt;td&gt;5557679000&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=LEFT(A1,3)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=MID(A1,4,3)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=RIGHT(A1,4)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
&lt;td&gt;8884878000&lt;/td&gt;
&lt;td&gt;888&lt;/td&gt;
&lt;td&gt;487&lt;/td&gt;
&lt;td&gt;8000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;3&lt;/td&gt;
&lt;td&gt;9994879000&lt;/td&gt;
&lt;td&gt;999&lt;/td&gt;
&lt;td&gt;487&lt;/td&gt;
&lt;td&gt;9000&lt;/td&gt;
&lt;/tr&gt;

&lt;/table&gt;

&lt;p&gt;The above table shows you the functions used in row 1 and the results produced in rows 2 and 3.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;left()&lt;/strong&gt; function grabs the area code by taking the three leftward digits of the phone number. The last four digits are grabbed by &lt;strong&gt;right()&lt;/strong&gt;. &lt;strong&gt;Mid()&lt;/strong&gt; is used to grab the middle digits. You have to specify three pieces of information to use &lt;strong&gt;Mid()&lt;/strong&gt;: The phone number, a starting point, and the number of characters to grab. In this example, we want to grab a portion of the phone number in &lt;strong&gt;A1&lt;/strong&gt;, starting at the 4th character ('7'), and continuing for 3 characters.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-1240235243604898436?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/1240235243604898436?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/1240235243604898436?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/10/splitting-telephone-number-in-microsoft.html' title='Splitting a telephone number in Microsoft Excel'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author></entry><entry gd:etag='W/&quot;A0EDQHg9cSp7ImA9WhRTEUs.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-5130009292980140117</id><published>2011-10-25T18:55:00.000-07:00</published><updated>2011-11-01T10:47:51.669-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-11-01T10:47:51.669-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='Stata'/><category scheme='http://www.blogger.com/atom/ns#' term='Raster'/><category scheme='http://www.blogger.com/atom/ns#' term='Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='plot'/><category scheme='http://www.blogger.com/atom/ns#' term='Inkscape'/><category scheme='http://www.blogger.com/atom/ns#' term='graph'/><category scheme='http://www.blogger.com/atom/ns#' term='Vector'/><category scheme='http://www.blogger.com/atom/ns#' term='Better Graphics'/><category scheme='http://www.blogger.com/atom/ns#' term='emf'/><title>Using Inkscape to improve Stata graphics</title><content type='html'>Stata produces graphics that can be hard to work with and are often ugly. Often times, I have trouble with labels running into one another or blocky looking elements. Moreover, I sometimes need to change a title, add a caption, or change a color and reproducing the graph in Stata to do this is both time consuming and annoying. Luckily, I have found an easy way to edit graphs in Stata, improve there look, and tweak them if need be. You use a program called &lt;a href="http://inkscape.org/"&gt;Inkscape&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
To illustrate, take a look at the following the following graph produced using the following code:&lt;br /&gt;
&lt;div class="codewrap"&gt;
&lt;div class="numbers"&gt;
&lt;ol&gt;
&lt;li&gt;1&lt;/li&gt;
&lt;li&gt;2&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class="code"&gt;
&lt;code&gt;
use http://www.stata-press.com/data/r11/uslifeexp2&lt;br /&gt;
twoway (scatter le year), scheme(s1color)
&lt;/code&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-19AAaGDAOg8/TqdNaxBJseI/AAAAAAAACC0/QkpYuO_zdC4/s1600/Graph+better.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="290" src="http://2.bp.blogspot.com/-19AAaGDAOg8/TqdNaxBJseI/AAAAAAAACC0/QkpYuO_zdC4/s400/Graph+better.png" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Scatterplot of Life expectancy vs. Year produced in Stata - looks ok.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Normally, in Stata if you want to adjust objects within your graph you can do so using one of the graphics dialogues or the graphics editor but you are limited in what you can do. You cannot do things like add&amp;nbsp;gradients, use special fonts, add a photo, or sharpen the look of markers.&lt;br /&gt;
&lt;br /&gt;
Certainly, this is a functional graph but I like to make things look nicer and maybe make a few small changes. The answer, I've found, is to use &lt;a href="http://inkscape.org/"&gt;inkscape&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Tutorial (Windows)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
The following will get you started in inkscape to improve the look of graphs and plots produced in Stata. You should be able to move, scale, and change the color of objects in inkscape inkscape intuitively. If your looking to do more advanced stuff, consult the &lt;a href="http://inkscape.org/doc/index.php"&gt;Inkscape documentation&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
[1] If you haven't already, download and install &lt;a href="http://inkscape.org/"&gt;inkscape&lt;/a&gt; from their website.&lt;br /&gt;
&lt;br /&gt;
[2] Begin with your graph in the graph window, and export it as an &lt;b&gt;Enhanced Metafile (.emf)&lt;/b&gt;&amp;nbsp;file (select &lt;b&gt;File&lt;/b&gt;&amp;nbsp;&amp;gt; &lt;b&gt;Save As&lt;/b&gt;&amp;nbsp;&amp;gt; select &lt;b&gt;Enhanced Metafile&amp;nbsp;(*.emf)&lt;/b&gt;)&lt;br /&gt;
&lt;br /&gt;
[3] Now open Inkscape and load up your &lt;b&gt;emf &lt;/b&gt;file. The first thing you'll notice is that things seem to look better. Markers and text are sharper and less blocky and pixelated.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-ySAYyrkDthQ/TqdeR9iH-kI/AAAAAAAACC8/Oh2_q_I1s-I/s1600/alias+comparison.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-ySAYyrkDthQ/TqdeR9iH-kI/AAAAAAAACC8/Oh2_q_I1s-I/s1600/alias+comparison.png" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;The above shows what graph markers look like in Stata&lt;br /&gt;
&amp;nbsp;and in png exports. The bottom shows what they look like&lt;br /&gt;
as emf exports in inkscape.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
The reason this is the case is because &lt;a href="http://en.wikipedia.org/wiki/Windows_Metafile"&gt;emf files&lt;/a&gt; can contain, and in this case do contain &lt;a href="http://en.wikipedia.org/wiki/Vector_graphics"&gt;vector graphics&lt;/a&gt;&amp;nbsp;as opposed to &lt;a href="http://en.wikipedia.org/wiki/Raster_graphics"&gt;raster graphics&lt;/a&gt;. Vector graphics have many advantages. Graphics are sharper and more accurate, and they don't degrade when there size is increased. If you frequently produce posters they can be exported from inkscape at enormous sizes so that they won't look fuzzy.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
Once your file is in Inkscape all of the individual elements (down to each individual marker) can be edited. You can change the color, move them around, adjust labels (and prevent them from running into one another), add a background gradient, or even add a photo of your family in the background if you wanted!&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-uNunGWuBDzE/TqdggIsM4lI/AAAAAAAACDE/pRqBk6X-XUU/s1600/inkscape_graph.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="236" src="http://1.bp.blogspot.com/-uNunGWuBDzE/TqdggIsM4lI/AAAAAAAACDE/pRqBk6X-XUU/s320/inkscape_graph.PNG" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Here is what your window should look like in Inkscape.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
[4] In order to begin editing individual elements, you have to ungroup your graph. While the entire graph is selected click &lt;b&gt;Object &amp;gt; Ungroup&lt;/b&gt;. You should now have something that looks like this:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-r8Iz16yTtx4/Tqdh_OTE5dI/AAAAAAAACDM/0K4r4nDkBcU/s1600/ungrouped.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="237" src="http://4.bp.blogspot.com/-r8Iz16yTtx4/Tqdh_OTE5dI/AAAAAAAACDM/0K4r4nDkBcU/s320/ungrouped.PNG" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;All objects un-grouped.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div&gt;
As you can see, all of the individual elements are now selected. You should feel at home moving objects around, changing text, and scaling objects if you have used Microsoft Powerpoint. If you want to go further and change colors click this button:&lt;br /&gt;
&lt;div class="icon"&gt;
&lt;img border="0" src="http://4.bp.blogspot.com/-nXzClt0uLB0/TqdjllyV-1I/AAAAAAAACDU/MWgDZ3vE9is/s1600/fill+and+stroke.PNG" /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&amp;nbsp;&lt;/span&gt;Fill and Stroke&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
This will toggle a panel allowing you to change the color and outline of objects in your graph.&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;span style="font-size: large;"&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-JdLZs9l_6CI/TqdnzPJ9a0I/AAAAAAAACDk/vL1xyday1QI/s1600/final.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="249" src="http://1.bp.blogspot.com/-JdLZs9l_6CI/TqdnzPJ9a0I/AAAAAAAACDk/vL1xyday1QI/s320/final.png" width="320" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Final Version&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The following adjustments were made to the graph shown above which was originally produced in Stata, and edited later in Inkscape.&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Title Added&lt;/li&gt;
&lt;li&gt;Background gradient added&lt;/li&gt;
&lt;li&gt;Axis titles capitalized and moved slightly.&lt;/li&gt;
&lt;li&gt;Color of markers changed from green to blue and decreased in size.&lt;/li&gt;
&lt;li&gt;Outlier marker removed.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-5130009292980140117?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/5130009292980140117?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/5130009292980140117?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/10/using-inkscape-to-edit-graphics.html' title='Using Inkscape to improve Stata graphics'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-19AAaGDAOg8/TqdNaxBJseI/AAAAAAAACC0/QkpYuO_zdC4/s72-c/Graph+better.png' height='72' width='72'/></entry><entry gd:etag='W/&quot;CUYERns_fSp7ImA9WhRTEE0.&quot;'><id>tag:blogger.com,1999:blog-756570494830640063.post-5412892846499772490</id><published>2011-10-24T16:48:00.000-07:00</published><updated>2011-10-30T12:31:47.545-07:00</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2011-10-30T12:31:47.545-07:00</app:edited><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='concatenation'/><title>Concatenation in Microsoft Excel</title><content type='html'>There are two ways to concatenate (merge the contents of two cells) in Microsoft Excel.&lt;br /&gt;
&lt;table class="excel"&gt;
 &lt;tbody&gt;
&lt;tr class="eletter"&gt;
&lt;td&gt;&lt;/td&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;B&lt;/td&gt;&lt;td&gt;C&lt;/td&gt;&lt;td&gt;D&lt;/td&gt;&lt;td&gt;E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
 &lt;td class="enumber"&gt;1&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;b&gt;Item 1&lt;/b&gt;&lt;/td&gt;
  &lt;td&gt;&lt;b&gt;Item 2&lt;/b&gt;&lt;/td&gt;
  &lt;td&gt;&lt;b&gt;Function&lt;/b&gt;&lt;/td&gt;
  &lt;td&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/td&gt;
 
 &lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;2&lt;/td&gt;
  &lt;td style="text-align: center;"&gt;&lt;b&gt;Method 1&lt;/b&gt;&lt;/td&gt;
  &lt;td&gt;Hello&lt;/td&gt;
  &lt;td&gt;World!&lt;/td&gt;
  &lt;td&gt;=CONCATENATE(B2,C2)&lt;/td&gt;
  &lt;td&gt;Hello World&lt;/td&gt;
  
 &lt;/tr&gt;
&lt;tr&gt;
&lt;td class="enumber"&gt;3&lt;/td&gt;
  &lt;td style="text-align: center;"&gt;&lt;b&gt;Method 2&lt;/b&gt;&lt;/td&gt;
  &lt;td&gt;This is a way to&lt;/td&gt;
  &lt;td&gt;Concatenate&lt;/td&gt;
  &lt;td&gt;=B3 &amp;amp; C3&lt;/td&gt;
  &lt;td&gt;This is a way to Concatenate&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
The first method uses the &lt;b&gt;=CONCATENATE([item 1], [item 2], [item ...])&lt;/b&gt; function. Each cell specified within this function will be joined.&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can simply use the &lt;b&gt;&amp;amp;&lt;/b&gt; symbol to join the contents of two cells.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/756570494830640063-5412892846499772490?l=gridscape.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/5412892846499772490?v=2'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/756570494830640063/posts/default/5412892846499772490?v=2'/><link rel='alternate' type='text/html' href='http://gridscape.blogspot.com/2011/10/concatenation-in-microsoft-excel.html' title='Concatenation in Microsoft Excel'/><author><name>Elwood Cook</name><uri>http://www.blogger.com/profile/09383690130567157039</uri><email>noreply@blogger.com</email></author></entry></feed>