{"id":2884,"date":"2012-12-08T04:42:27","date_gmt":"2012-12-08T09:42:27","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=2884"},"modified":"2012-12-08T04:44:17","modified_gmt":"2012-12-08T09:44:17","slug":"semi-programming-as-a-way-to-simplify-life","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/semi-programming-as-a-way-to-simplify-life\/","title":{"rendered":"Semi-programming as a way to simplify life"},"content":{"rendered":"<p>More about the Los Angeles Basin SAS Users Group (LABSUG) later, but I did want to mention one tangential point from the first presentation. It was on the Graphics Template Language (GTL). The first example was pretty cool, looking at the population pyramid by gender and year for the United States, then for Qatar at the same time. This is obviously hundreds of numbers to plot &#8211; age by gender for two countries for two years.<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/poppyramid.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-2885\" title=\"\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/poppyramid-300x203.jpg\" alt=\"Population pyramid\" width=\"300\" height=\"203\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/poppyramid-300x203.jpg 300w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/poppyramid.jpg 758w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can read how to make this here,<a href=\"http:\/\/support.sas.com\/resources\/papers\/proceedings12\/267-2012.pdf\"> in the paper presented at SAS Global Forum this year, Off the Beaten Path<\/a>.<\/p>\n<p>So, this plot was cool, but there were others that I looked at the plot and thought, &#8220;Gee, I&#8217;d just have an artist draw that.&#8221;<\/p>\n<p>My take-away from that session was that you COULD graph anything anyway with GTL. Whether it was worth the effort or not is another story.<\/p>\n<p>This brings me to &#8220;semi-programming&#8221; which is a term I just made up. (Not to be confused with semi-infinite programming, which is actually a thing, or quasi-programming, which is what I was going to call it until I found out that was another actual thing.)<\/p>\n<p>Semi-programming is when it is simpler to program half the solution and do the other half some other way.<\/p>\n<p><strong>SEMI-PROGRAMMING EXAMPLE #1<\/strong><\/p>\n<p>Let&#8217;s say your boss wanted you to create a bubble plot of the relative sizes of all the 14 most popular animal species in the Santa Barbara Zoo and have the bubble size be relative to the mean weight of animals of that species. I&#8217;m sure you could do something with SAS or some other program with a gazillion programming statements to draw capybaras and parrots and other species on your chart. Or, you could do the bubble plot, find the 14 animal species photos on wikipedia, paste them on to the plot, dragging each photo to be the right size to just fit over that bubble. You could probably do the whole thing with three statements, a few minutes on google and some copying and pasting and be done in half an hour.<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/220px-Wet-capyvara-in-Brazil.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2886\" title=\"\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/12\/220px-Wet-capyvara-in-Brazil.jpg\" alt=\"capybara\" width=\"220\" height=\"146\" \/><\/a><\/p>\n<p>Spare me the question,<\/p>\n<blockquote><p>&#8220;What if you have to do it again?&#8221;<\/p><\/blockquote>\n<p>My initial reaction is, then you quit because your boss is an ass if she regularly asks you to do stuff like that. Seriously though, you could create a bunch with the semi-programming method in the time it would take you to do ONE purely programming.<\/p>\n<p><strong>SEMI-PROGRAMMING EXAMPLE #2<\/strong><\/p>\n<p>Not convinced? I had another example today. I want to merge my pretest and posttest groups. Because they are very valuable, I don&#8217;t want to lose a single subjects. Unfortunately, our subjects are children and due to very strict concerns about confidentiality, we have no personally identifying information. We merge the data sets by username, by grade, by school. In a few cases, the kids did the test twice. It&#8217;s online. They accidentally submitted the test, then realized they had skipped a questioned or two, so they opened it again and continued on the test. (There&#8217;s a reason we want them to be able to do that.)<\/p>\n<p>So, we have two identical records for that child.<\/p>\n<p>Sometimes, though, there are two usernames because kids at two different schools had similar usernames and one mis-typed it. So, your username might by MightyMan \u00a0and mine is MightyMean and I accidentally left out the &#8220;e&#8221;. \u00a0So, it is NOT the same kid twice. One way to see if it is a real duplicate versus an error is to sort the data sets by school, grade and then username and merge them &#8211; but what about if the student didn&#8217;t enter the name of the school , which a few did not? Or entered the wrong school? (Yes, that happened.)<\/p>\n<p>I thought about all kinds of complicated solutions to this until it occurred to me that there were probably no more than 5 or 6 records that were really a problem. So, here is my semi-programming solution.<\/p>\n<p>1. Write a program that does this:<\/p>\n<ul>\n<li>Sorts records by username, grade and school<\/li>\n<li>If there is no duplicate (it is the only student, username, grade combination) output that to one data set<\/li>\n<li>If there is a duplicate, output those records to the other dataset<\/li>\n<\/ul>\n<p>2. Look at the 5 or 6 records that are duplicates. Identify which are the same student twice, in which case, delete the incomplete one. If it is a case of an error, see that MightyMean is really at school number 2, and enter an e in the username.<\/p>\n<p>Since I expect no more than half a dozen of these, it will probably take me less than a minute to fix them manually, after I have my little program to spit out the problem children.<\/p>\n<p>Semi-programming. Think about it.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>More about the Los Angeles Basin SAS Users Group (LABSUG) later, but I did want to mention one tangential point from the first presentation. It was on the Graphics Template Language (GTL). The first example was pretty cool, looking at the population pyramid by gender and year for the United States, then for Qatar at&#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":[1],"tags":[],"class_list":["post-2884","post","type-post","status-publish","format-standard","hentry","category-dr-de-mars-general-life-ramblings"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/2884","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=2884"}],"version-history":[{"count":2,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/2884\/revisions"}],"predecessor-version":[{"id":2888,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/2884\/revisions\/2888"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=2884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=2884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=2884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}