{"id":570,"date":"2010-07-04T02:33:11","date_gmt":"2010-07-04T07:33:11","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=570"},"modified":"2010-07-04T02:37:31","modified_gmt":"2010-07-04T07:37:31","slug":"signs-youre-not-a-novice-programmer","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/signs-youre-not-a-novice-programmer\/","title":{"rendered":"Signs you&#8217;re not a novice programmer"},"content":{"rendered":"<figure id=\"attachment_572\" aria-describedby=\"caption-attachment-572\" style=\"width: 260px\" class=\"wp-caption alignright\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-572\" title=\"evaeats\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2010\/07\/evaeats.jpg\" alt=\"I'll get this down eventually\" width=\"260\" height=\"249\" \/><figcaption id=\"caption-attachment-572\" class=\"wp-caption-text\">I&#39;ll get this down eventually<\/figcaption><\/figure>\n<p>Writing a presentation for <a href=\"http:\/\/www.wuss.org\">WUSS<\/a>, I had to fill out the usual check box for the intended audience:<\/p>\n<p>Level of programming expertise:<\/p>\n<p>___ Novice  __ Intermediate  __ Advanced<\/p>\n<p>and I started wondering when exactly does someone stop being a novice?  One answer is that your programming no longer LOOKS like it was written by a novice. That&#8217;s kind of circular reasoning, though, isn&#8217;t it? To be more specific, here are a few of those signs, generated from a survey of a random sample of 1.<\/p>\n<p><em>(Note, if your programming does not always show all of the characteristics mentioned below, you are forbidden to feel bad. All but a very exceptional few programmers will admit to having made every &#8216;newbie&#8217; mistake when they started, and on occasion, they still do when they are rushed, tired or distracted by three fighting children or after their third martini. As for that exceptional few &#8211; they&#8217;re chronic liars. Stay away from them.)<\/em><\/p>\n<p>Five signs you&#8217;re no longer a novice, in no particular order &#8230;.<\/p>\n<p><strong>1. Good use of functions<\/strong><\/p>\n<p>AvgQtr = (Jan + Feb + Mar) \/3<\/p>\n<p>is a sign of a novice<\/p>\n<p>AvgQtr = Sum(Jan, Feb, Mar) \/3<\/p>\n<p>is better<\/p>\n<p>AvgQtr = Mean(Jan,Feb, Mar)<\/p>\n<p>is what an intermediate programmer would do.<\/p>\n<p><strong>2. You know options of options<br \/>\n3. You understand how the particular language you are using processes data.<\/strong><\/p>\n<p>For example, in SAS, let&#8217;s say you have two datasets<\/p>\n<p>Pretest has the following variables: Id Age Gender Testscore<br \/>\nWhere testscore is (obviously) the pretest score.<br \/>\nPosttest has the same variables: Id Age Gender Testscore<br \/>\nWhere testscore is (obviously) the posttest score.<\/p>\n<p>If you do this (bad!)<\/p>\n<p><code>Proc sort data = libref.pretest  ;<br \/>\n\tBy id ;<br \/>\nProc sort data = libref.posttest ;<br \/>\n\tBy id ;<br \/>\nData libref.alltests ;<br \/>\n\tMerge libref.pretest libref.posttest ;<br \/>\n\tBy id ;<br \/>\n<\/code><br \/>\nYou have just created a dataset that is a copy of posttest because the testscore from the second dataset named will copy over the first.<\/p>\n<p>Try this:<\/p>\n<p><code>Proc sort data = libref.pretest out = pre  (rename = (testscore = pretest)) ;<br \/>\n\tBy id ;<br \/>\nProc sort data = libref.posttest  out= post (rename = (testscore = posttest));<br \/>\n\tBy id ;<br \/>\nData libref.alltests ;<br \/>\n\tMerge pre post ;<br \/>\n\tBy id ;<\/code><\/p>\n<p>Yes, you COULD have done this by at least one data step where you renamed the testscore variable, but adding an extra step is inefficient.<\/p>\n<p>A good, short article on<a href=\"http:\/\/www2.sas.com\/proceedings\/sugi31\/030-31.pdf\"> beyond the basics in proc sort was written by Kelsey Basset<\/a>.<\/p>\n<p><strong>4. Use your knowledge of functions in your programming logic.<br \/>\n5. Don\u2019t forget about missing values.<\/strong><\/p>\n<p>For example, a researcher wants to categorize people who have ANY positive response to five questions on raising taxes, \u201cWould you vote to raise taxes if \u2026 the state budget isn\u2019t balanced?\u201d \u201cWould you raise taxes if \u2026 the option was to cut social services?\u201d and so on.<\/p>\n<p>A novice response would be:<\/p>\n<p><code>If q1 = 1 then taxes = 1 ;<br \/>\n     Else If q2 = 1 then taxes = 1 ;<br \/>\n     Else If q3 = 1 then taxes = 1 ;<br \/>\n     Else If q4 = 1 then taxes = 1 ;<br \/>\n     Else If q5 = 1 then taxes = 1 ;<br \/>\n\tElse taxes = 0 ;<br \/>\n<\/code><br \/>\nBetter   <\/p>\n<p><code>If sum(of q1 \u2013 q5) > 0 then taxes = 1 ;<br \/>\n\t\tElse if \tsum(of q1 \u2013 q5)  =  0 then taxes = 0 ;<\/code><\/p>\n<p>The reason for having the second IF in there is that if you do not then all of those with missing values get set to zero, which may result in throwing off your results by a great deal, depending on how frequent missing data is.<\/p>\n<p>There are a variety of ways, some better some worse. However, one statement that does exactly what we want is :<\/p>\n<p><code>Taxes = Max(of q1 \u2013 q5) ;<\/code><\/p>\n<p>If any of the questions were answered 1, the value of taxes is 1. If all were answered 0, the value is 0 and if all were missing, the value is missing.<\/p>\n<p>I saw a <a href=\"http:\/\/people.wku.edu\/douglas.smith\/SPSSCOMMANDS1.htm\">similar example from SPSS on Douglas Smith&#8217;s page<\/a>. Although Recode is actually a command and not a function, my point is the same. Once you proceed from being a novice, you are naturally seeing the ways you can make your program more efficient.<\/p>\n<p><em>&#8220;Another example of using recode might be to invert the order of the values for a subjective evaluation variable. For instance, the variable \u201chappy\u201d has three valid response categories:<\/p>\n<p>1 = Very Happy<br \/>\n2= Pretty Happy<br \/>\n3 = Not Too Happy<\/p>\n<p>You might want to change the order to go from least happy to most happy. To do this, all you need to do is swap the values 1 and 3. The recode statement that will accomplish this is:<\/p>\n<p><code>recode happy (1=3) (3=1). <\/code><\/em><\/p>\n<p>Oh, and if you don&#8217;t use the command window, much less the Do-file editor in Stata, you are definitely a novice. Same goes for anyone who doesn&#8217;t write syntax for SPSS or hasn&#8217;t found a use for the Program window in SAS Enterprise Guide.<\/p>\n<p>That isn&#8217;t to say that there will never come a day when one can be considered a programmer by simply being very good at pointing and clicking.<\/p>\n<p>Just sayin&#8217; &#8230;. today is not that day.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Writing a presentation for WUSS, I had to fill out the usual check box for the intended audience: Level of programming expertise: ___ Novice __ Intermediate __ Advanced and I started wondering when exactly does someone stop being a novice? One answer is that your programming no longer LOOKS like it was written by a&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9,8],"tags":[],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-software","category-technology"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=570"}],"version-history":[{"count":4,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":575,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/570\/revisions\/575"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}