{"id":5791,"date":"2020-01-06T21:15:39","date_gmt":"2020-01-07T02:15:39","guid":{"rendered":"https:\/\/www.thejuliagroup.com\/blog\/?p=5791"},"modified":"2020-01-06T21:15:41","modified_gmt":"2020-01-07T02:15:41","slug":"from-phpmyadmin-to-sas-studio-for-lazy-people","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/from-phpmyadmin-to-sas-studio-for-lazy-people\/","title":{"rendered":"From PHPMyAdmin to SAS Studio for lazy people"},"content":{"rendered":"\n<p>I need to get a data set into SAS for a course I&#8217;m teaching in March. Students like real data and some kind folks were willing to allow their de-identified data to be used. Win-win.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How did I get this data? In a SAS data set with a handy code book? Oh, very funny!<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"309\" src=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/me_rondalaugh.jpg\" alt=\"A bunch of people laughing\" class=\"wp-image-5792\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/me_rondalaugh.jpg 450w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/me_rondalaugh-300x206.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><figcaption>This blog will pause while we all laugh at your naivete<\/figcaption><\/figure><\/div>\n\n\n\n<p>I received a login to PHPMyAdmin where the data which were definitely not created for my personal convenience reside.<\/p>\n\n\n\n<p>First,  I downloaded the data as CSV for Excel. This gave me a file where everything was like this.<\/p>\n\n\n\n<p>re_apply;&#8221;consumer_id&#8221;;&#8221;email&#8221;;&#8221;counselor&#8221;;&#8221;gender&#8221;;&#8221;date_of_birth&#8221;;&#8221;age&#8221;;&#8221;primary_disability&#8221;;&#8221;secondary_disability&#8221;;&#8221;education&#8221;;&#8221;member&#8221;;&#8221;tribe&#8221;;&#8221;district&#8221;;&#8221;job_when_entered&#8221;;&#8221;if_job_earnings&#8221;;&#8221;earnings_type_before&#8221;;&#8221;referral&#8221;;&#8221;other_refer&#8221;;&#8221;application_date&#8221;;&#8221;assessment_date&#8221;;&#8221;eligibility_date&#8221;;&#8221;ipe_date&#8221;;&#8221;notify_rights&#8221;;&#8221;vocational_goal&#8221;;&#8221;state_vr&#8221;;&#8221;status&#8221;;&#8221;closure_date&#8221;;&#8221;status_type&#8221;;&#8221;employment_date&#8221;;&#8221;type_employ&#8221;;&#8221;start_job_earnings&#8221;;&#8221;post_job_earnings&#8221;;&#8221;earnings_type_after&#8221;;&#8221;intermediate_goal&#8221;;&#8221;semesters&#8221;;&#8221;int_completed&#8221;;&#8221;intermediate_date&#8221;;&#8221;last_contact_date&#8221;;&#8221;comment&#8221;<\/p>\n\n\n\n<p>Yes, one, long line with everything in quotes and every column separated by a semi-colon. These are the column names but all of the data are in this exact same format as well.<\/p>\n\n\n\n<p>Of course, you COULD upload this file and read it into SAS but that would take time and effort.<\/p>\n\n\n\n<p>OR you can download a regular CSV or ODS spreadsheet file, just pick one of the other options, and then all your data would be in nice columns but you have no header row. Of course, that&#8217;s pretty easy to write an input statement in SAS. You just need to type in a hundred or variable names and be sure to have the format correctly specified. Not hard but probably take you more than a minute.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"378\" height=\"659\" src=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/PHP2.png\" alt=\"\" class=\"wp-image-5794\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/PHP2.png 378w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/PHP2-172x300.png 172w\" sizes=\"auto, (max-width: 378px) 100vw, 378px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/communities.sas.com\/t5\/SAS-Data-Management\/import-sql-file\/td-p\/328239\">You COULD theoretically download the data as an SQL file and use SQL connect according to some smart and less lazy people on SAS Communities<\/a>.<\/p>\n\n\n\n<p>And, as some of the posters noted on that forum, not everyone has access to SQL connect.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Or, you could be a completely lazy person like me and fix it all in about 12 clicks.<\/h2>\n\n\n\n<p>Here is how:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Download the file as CSV for Excel<\/li><li>Copy and paste the first line, the header, into Word<\/li><li>Replace all the quotes with nothing, using Replace from the EDIT menu<\/li><li>Under the TABLE command select &#8220;CONVERT TEXT TO TABLE&#8221;. For &#8220;Separate text at&#8221;, click on Other and put in a semi-colon.<\/li><li>Now you have all of your filenames in nice columns as a table, copy that.<\/li><li>Download the file again as CSV<\/li><li>Insert a row and paste the filenames you copied  in Step 5<\/li><li>Save that file as an Excel file<\/li><li>Upload it into SAS Studio<\/li><li>Under TASKS and UTILITIES, select IMPORT DATA, drag your file you uploaded to the window and click on the little running guy.<\/li><\/ol>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/text_table-1.png\" alt=\"Converting from text to table\" class=\"wp-image-5796\" width=\"362\" height=\"367\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/text_table-1.png 724w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/text_table-1-296x300.png 296w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><figcaption>Click 8 or So<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-06-at-18.00.54.png\" alt=\"Tasks and utilities\" class=\"wp-image-5797\" width=\"309\" height=\"240\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-06-at-18.00.54.png 412w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-06-at-18.00.54-300x233.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><figcaption>All that&#8217;s left is to drag the file<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>You can get data from PHPMyAdmin into SAS Studio with a dozen clicks, even if you know zero SQL.<\/p>\n","protected":false},"author":2,"featured_media":5797,"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-5791","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dr-de-mars-general-life-ramblings"],"jetpack_featured_media_url":"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-06-at-18.00.54.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5791","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\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=5791"}],"version-history":[{"count":2,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5791\/revisions"}],"predecessor-version":[{"id":5798,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5791\/revisions\/5798"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media\/5797"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=5791"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=5791"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=5791"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}