User peterc - RunSubmit.commost recent 30 from http://www.runsubmit.com2010-07-29T20:05:14Zhttp://www.runsubmit.com/feeds/user/68http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://www.runsubmit.com/questions/215/how-do-i-programmatically-create-new-catalogs/217#217Answer by PeterC for How do I programmatically create New Catalogs?PeterC2010-01-22T16:19:44Z2010-01-22T16:19:44Z<p>I guess SCL would offer a more direct way, but here is a simple technique with </p>
<pre><code>proc catalog catalog= sasuser.empty ;
copy in=sasuser.profile out= sasuser.empty ;
select _all_ /et= none ;
run;
quit;
</code></pre>
<p>It is very unlikely that there is an entrytype 'none'</p>
<p>PeterC</p>
http://www.runsubmit.com/questions/113/finding-out-the-name-and-path-of-the-program-being-run/214#214Answer by PeterC for Finding out the name and path of the program being runPeterC2010-01-13T10:09:21Z2010-01-13T10:09:21Z<p>beware the Environment variables <code>SAS_EXECFILEPATH</code> and <code>SAS_EXECFILENAME</code><br />
These are filled through the "file-open" dialog of enhanced editor (hence windows-only).
Since there can be more than one such editor window open, which do you think the (single) environment variable <code>SAS_EXECFILEPATH</code> should show?</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/213#213Answer by PeterC for SAS Coding StandardsPeterC2010-01-13T08:30:26Z2010-01-13T08:30:26Z<p>For code reviews, take time to print programs well - use something like word, with it's linenumbers (it is defined in page-layout, but make its font smaller) and have the original filename-with-path in the header, datetime in the footer (even better than a version number). Force wide lines to print on one, or split them in the original. After opening the sas program in word (with no colouring), paste the code from the enhanced editor over the program in word. Then you still have the path-name in the header from the word-open, but you get the syntax color and format highlighting from sas enhanced editor. Make sure the last line number in SAS is same as last line number in Word, and find/fix the line that is too wide (comments are easy to change to arial, but that doesn't suit code).</p>
<p>The more attention you pay to making your code readable, the more you'll be thanked by th eprogrammer who has to support it through problems (caused by bad data, or miss-use of course, you'll have no bugs in well presented code ;-) because attention to detail often highlights the bug before it is even tested!</p>
<p>just my opinions
PeterC</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/212#212Answer by PeterC for SAS Coding StandardsPeterC2010-01-13T07:24:20Z2010-01-13T07:24:20Z<p>For comma-separated lists, like sql columns and macro parameters, where there are more than a few parameters, make continuation lines start with the comma, rather than ending the "unfinished" line with the comma. When "continuations start with comma" is your standard, it is very easy to check all commas are present, and very easy to delete/insert extra lines.</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/211#211Answer by PeterC for SAS Coding StandardsPeterC2010-01-13T06:52:30Z2010-01-13T06:52:30Z<p>In SQL adopt the code layout standard used by SAS when you describe an sql view. The main theme of this is to separate keywords on the left from the lists (variables, tables, conditions, etc) on the right.</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/210#210Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T21:04:22Z2010-01-12T21:04:22Z<p>In a block of code which are mainly assignments, align the = </p>
http://www.runsubmit.com/questions/169/sas-coding-standards/209#209Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T20:13:40Z2010-01-12T20:13:40Z<p>Always replace tabs with spaces ( helps viewing code in other viewers).</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/208#208Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T18:37:56Z2010-01-12T18:37:56Z<p>Use enhanced editor abbreviations to simplify inserting block comments and prog headers - when it is the "easy way" it becomes the norm. (imho)</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/207#207Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T18:04:28Z2010-01-12T18:04:28Z<p>Try to have a blank before each word of code (ok libname.memname cannot have that blank before memname, but that's the kind of exception that proves my rule;-)</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/206#206Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T17:33:26Z2010-01-12T17:33:26Z<p>When defining parameters like data=, out=, filevar=, which all are name/value pairs, place the = against the parameter name. That distinguishes options without = like nodupkey from those which must have the =. It helps me remember the various bits. </p>
http://www.runsubmit.com/questions/169/sas-coding-standards/205#205Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T16:51:50Z2010-01-12T17:32:39Z<p>Consider a spell checker: place the open-bracket right next to the function name [ sum( a, b, c ) and not sum (a,b,c) ] </p>
<p>The same for array references </p>
http://www.runsubmit.com/questions/169/sas-coding-standards/204#204Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T16:40:06Z2010-01-12T16:40:06Z<p>take advantage of sas variable lists wherever possible, but document to clarify (don't you hate long lists of variables in a single column that runs over more than a screen, and is mostly repeated later in the prog!?)</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/203#203Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T16:34:31Z2010-01-12T16:34:31Z<p>place "non-executable code" together (probably near the beginning) of a data step</p>
http://www.runsubmit.com/questions/169/sas-coding-standards/202#202Answer by PeterC for SAS Coding StandardsPeterC2010-01-12T16:30:31Z2010-01-12T16:30:31Z<p>use white space to align logical / consistent code (not just do and end)</p>
http://www.runsubmit.com/questions/196/disabling-sas-modules/201#201Answer by PeterC for Disabling SAS modules?PeterC2010-01-12T15:41:33Z2010-01-12T15:41:33Z<p>If you want to simulate another's "SAS licence combination" either use their licence, or get your SAS supplier to provide a licence to match. [I leave the commercial and legal rules to another discussion].</p>
<p>There is a macro function, used like %sysprod(connect) which is the official way to test for the existence of a product. It uses the setinit information. If you don't change that, the SAS components expect to be able to use facilities that might not be available to the other environment. </p>
<p>OK, with no pointer to the executables by removing the paths from the config file, the calls will fail, but it might be "cleaner" to get the normal message in the SASlog that the component is not licensed. </p>
<p>PeterC</p>