{"id":537,"date":"2010-06-07T03:09:57","date_gmt":"2010-06-07T08:09:57","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=537"},"modified":"2010-06-07T03:19:28","modified_gmt":"2010-06-07T08:19:28","slug":"sas-enterprise-guide-as-a-magic-wand","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/sas-enterprise-guide-as-a-magic-wand\/","title":{"rendered":"SAS Enterprise Guide as a Magic Wand"},"content":{"rendered":"<p>You know those give-aways you get at conferences? The favorite one I ever saw, which I did not get because they had run out of them, was a magic wand. It was wand-shaped, with sparkles floating inside, they had a vase full of them with a note that this was the magic wand some people seemed to want you to wave to make all of the bugs disappear.<\/p>\n<p>It did not have sparkles, much to my disappointment, but SAS Enterprise Guide actually made all of my data problems disappear today and I was happy.<\/p>\n<p>Here is my problem &#8211; I downloaded a dataset from <a href=\"http:\/\/www.icpsr.org\">ICPSR (Interuniversity Consortium for Political and Social Research)<\/a> that had hundreds of variables, each of which had a user-defined format and a name like V12345. I did not want hundreds of variables. I actually only wanted (I thought) 21.<\/p>\n<p>So, first I did this in SAS 9.2 which read in the .stc file using PROC CIMPORT and kept me from getting format errors since I had the nofmterr option.<\/p>\n<p><code>Libname in \"E:\\DS0008\" ;<br \/>\nFilename readit 'E:\\DS0008\\25422-0008-Data.stc' ;<br \/>\nproc cimport infile = readit  library = in ;<br \/>\noptions nofmterr ;<br \/>\ndata in.iom ;<br \/>\n\tset in.da25422p8 ;<br \/>\nkeep caseid v4259 - v4267 v4240 v4253 v4254 v4255 v4241 v4240 v4116 - v4121 ;<br \/>\nrun;<\/code><\/p>\n<p>BUT &#8230; I still wanted to rename all of these variables and change the formats.  I closed SAS and opened up Enterprise Guide. <\/p>\n<p>Under EDIT, I turned off the PROTECT DATA. Then, for each of the variables, I right-clicked on the column (actual ctrl-click, since I was using a Mac) and selected properties. This was very efficient for me because I was not actually sure these were the exact variables I wanted and when I saw the labels I could delete some right then. I changed the names, labels and formats.<\/p>\n<p> I did not have to do a proc contents, write a drop statement for the variables I didn&#8217;t want, a rename statement for the variables I wanted to rename, a label statement for the variables I wanted to relabel and then an attrib statement or some other method of changing the format.  <\/p>\n<p> Then, I opened a code window and wrote a few lines for all numeric variables to have the -9 value changed to .  so it was Missing and didn&#8217;t throw off my calculations.<\/p>\n<p>Because I was very curious I selected from TASKS > CHARACTERIZE DATA to take a look at what I had. It was kind of sad, really. These data are from a longitudinal study of youth, and the particular variables I had were from their senior year of high school. The sad part was the great disparity between the percentage of students who said they expected to go to a four-year college and the percentage who actually will. Because this was the interesting part, I went to TASKS > MULTIVARIATE > CORRELATIONS (yeah, I wouldn&#8217;t have put correlations there, either, but whatever). In short, mother&#8217;s and father&#8217;s education both relate significantly to every positive educational outcome you can imagine, but mother&#8217;s education matters more. <\/p>\n<p>I right-clicked on the dataset in the Process Flow window and picked Export, to export it to Excel, since the person I am working with on this project does not have SAS on her computer.<\/p>\n<p>Okay, it&#8217;s past 1 a.m. and even though it is supercool that I was able to at least look at my data somewhat tonight, I need to go to bed so I can get up tomorrow and work to buy the world&#8217;s most spoiled twelve-year-old what she decides she wants next. Today it was a 32G iPhone, but the fact that my sixth-grader has in her pocket more computing power than existed in the world when her grandparents were twelve, well that&#8217;s another story.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You know those give-aways you get at conferences? The favorite one I ever saw, which I did not get because they had run out of them, was a magic wand. It was wand-shaped, with sparkles floating inside, they had a vase full of them with a note that this was the magic wand some people&#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-537","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\/537","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=537"}],"version-history":[{"count":3,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/537\/revisions"}],"predecessor-version":[{"id":540,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/537\/revisions\/540"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=537"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}