{"id":1912,"date":"2012-01-05T03:28:36","date_gmt":"2012-01-05T08:28:36","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=1912"},"modified":"2012-01-05T12:16:27","modified_gmt":"2012-01-05T17:16:27","slug":"sas-on-demand-stuff-with-stc-files-i-tried-for-the-hell-of-it","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/sas-on-demand-stuff-with-stc-files-i-tried-for-the-hell-of-it\/","title":{"rendered":"SAS On-Demand stuff with .stc files I tried for the hell of it"},"content":{"rendered":"<p>I&#8217;ve spent about 35 years messing around with computers based on the assumption that most discoveries are not preceded by &#8220;Eureka!&#8221; but rather,<\/p>\n<blockquote><p>&#8220;What the hell! May as well try it.&#8221;<\/p><\/blockquote>\n<p>Having my new computer pretty much dissolve in smoke (less than a month after I bought it!), I decided to continue my analyses of the Kaiser-Permanente data using SAS on demand . <a href=\"http:\/\/www.thejuliagroup.com\/blog\/?p=537\">I had downloaded this as\u00a0 a .stc file a while back, and used PROC CIMPORT to read it in, with all the formats, which I have mentioned before, is really, really easy to do<\/a>.<\/p>\n<p>I wondered what would happen if I uploaded the SAS dataset, you know, the .sas7bdat file\u00a0 and the FORMATS catalog to the SAS On-demand server. Would it work?<\/p>\n<p>Short answer &#8211; kind of.\u00a0 SAS On-Demand is very forgiving when it comes to format errors. It appears to have the NOFMTERR option turned on by default. I&#8217;d leave it alone.\u00a0 Look what happens when I do a simple table analysis. I get a table &#8211; sort of.<\/p>\n<p>This table doesn&#8217;t use the formats.\u00a0 No one reading it would know that 3 = &#8220;6+ drinks daily&#8221;. If it was just one format, I could use a PROC FORMAT and re-create it. No big deal.\u00a0 There are hundreds of variables and thousands of lines of format code I&#8217;d have to write. My first thought of<\/p>\n<blockquote><p>&#8220;What the hell, I&#8217;ll just drag and drop the folder with the formats&#8221;<\/p><\/blockquote>\n<p>was a failure.In fact, despite the fact that Filezilla shows that my format folder was uploaded, it doesn&#8217;t actually show up in the SAS server at all.<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/amntalcnolabel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1916\" title=\"amntalcnolabel\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/amntalcnolabel-300x266.png\" alt=\"Table on alcohol consumption with no formats\" width=\"300\" height=\"266\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/amntalcnolabel-300x266.png 300w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/amntalcnolabel.png 418w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>I suppose I could at this point go read some documentation or SAS user group papers &#8211; there is plenty out there &#8211;\u00a0 on moving catalogs between systems. Seriously, where is the fun in that?<\/p>\n<p>I still had the original .stc file lying around so I thought I would see if I could use PROC CIMPORT with SAS On demand.<\/p>\n<p>I had read-only access to the SAS server because that is what the students have, and I wanted to replicate what a student could or could not do.<\/p>\n<p>I uploaded the .stc file using Filezilla (nothing special about <a href=\"http:\/\/filezilla-project.org\/\">Filezilla, I just happen to like it<\/a>).<\/p>\n<p>When I looked in my the SAS library for my class, I did not see the file, even though all of the regular sas7bdat files showed up there, but I thought, what the hell, I&#8217;ll try the CIMPORT any way.<\/p>\n<p>Then, I ran this code:<\/p>\n<p><code>libname mydata \"\/courses\/univ.edu1\/i_432400\/a_2469\/saslib\" access=readonly;<br \/>\nFilename readit \"\/courses\/univ.edu1\/i_432400\/a_2469\/saslib\/04219-0001-data.stc\" ;<br \/>\nproc cimport infile = readit library = work\u00a0 ;<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Where the part in the quotes in the LIBNAME statement is the library for my course on the SAS server.<\/p>\n<p>and I got this error message:<\/p>\n<p><span style=\"color: #ff0000;\">ERROR: This transport file was created by an earlier release of SAS that did not record encoding.\u00a0<em> If and only if you <strong>know<\/strong><\/em> this\u00a0file was created from a SAS session running a UTF8 encoding, you may set the ISFILEUTF8 CIMPORT option to T (for TRUE) to\u00a0tell us to proceed to import this file.\u00a0 If it was not created by a UTF8 session, then you must import it in a session<\/span><br \/>\n<span style=\"color: #ff0000;\"> encoding that is compatible with the session encoding that produced that file.<\/span><\/p>\n<p><em>If and only if I <strong>know<\/strong> this file was created running a UTF8 encoding<\/em> ? Are you kidding me? Despite all the best warnings from my mother not to touch things if you don&#8217;t know where they&#8217;ve been, I downloaded this off the Internet! It could have originally been encoded in Korean for all I know (it wouldn&#8217;t be the first time).<\/p>\n<p>But then I said to myself,<\/p>\n<blockquote><p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/computergnome.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-1917\" title=\"computergnome\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/computergnome-168x300.png\" alt=\"Julia the computer gnome\" width=\"168\" height=\"300\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/computergnome-168x300.png 168w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2012\/01\/computergnome.png 230w\" sizes=\"auto, (max-width: 168px) 100vw, 168px\" \/><\/a>&#8220;Self, wait a minute here. If it<em><strong> is<\/strong><\/em> in fact UTF8 encoded and I say that is true, then it will work. And if it isn&#8217;t true, what&#8217;s the worst thing that could happen? A gnome with a candy-cane hat jumps out of my computer and slaps me? Not very damn likely.&#8221;<\/p><\/blockquote>\n<p>So, I added the option, ran the statement like this<\/p>\n<p>proc cimport infile = readit library = work ISFILEUTF8=TRUE ;<\/p>\n<p>My program ran, my \u00a0SAS log showed all the formats were output, when I ran analyses, my formats were there and used.<\/p>\n<p>All was right with the world.<\/p>\n<p>Just to make matters more complicated, let me throw in this \u00a0&#8212; if you had NOT made the library ACCESS = READONLY and tried to write to your class&#8217;s SAS library you would get a DIFFERENT error about the formats coming from a different system and it would not have worked.<\/p>\n<p>My guess, and it is just a random guess, is that maybe the class library had formats that were inconsistent with the older ones being uploaded so there was a conflict, while, since the work library is just held in working memory, there was nothing there to be inconsistent with. I could like it up or Google it or something. But I didn&#8217;t.<\/p>\n<p>Yes, it IS amazing that they give people with my level of maturity passwords to high performance computers. I find it hard to believe myself.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve spent about 35 years messing around with computers based on the assumption that most discoveries are not preceded by &#8220;Eureka!&#8221; but rather, &#8220;What the hell! May as well try it.&#8221; Having my new computer pretty much dissolve in smoke (less than a month after I bought it!), I decided to continue my analyses of&#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":[15,9],"tags":[],"class_list":["post-1912","post","type-post","status-publish","format-standard","hentry","category-open-data","category-software"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/1912","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=1912"}],"version-history":[{"count":8,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/1912\/revisions"}],"predecessor-version":[{"id":1926,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/1912\/revisions\/1926"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=1912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=1912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=1912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}