|
Hi Matt -
I have a couple dozen abbreviations - basically for anything a few
lines or more that I use on a frequent basis. One is an rsubmit block
- "rsu" returns
rsubmit;
run; endrsubmit; rsubmit;
run; endrsubmit;
which I use in coding between the PC and MVS.
Another is an Excel libname reference - "exc" returns
libname exbk excel 'J5000.xls' ;
DATA exbk.J5000(DBLABEL=YES);
SET temp.J5000;
run;
libname exbk clear;
options noxsync noxwait;
%sysexec "J5000.xls";
Which is pretty much how I finish 95% of my analyses.
I also have a "head"er version of the above
libname exbk excel 'header rows.xls' ;
data exbk.header;
set systems.data;
if mod(_n_,100)=1;
if _n_>5000 then stop;
run;
libname exbk clear;
options noxsync noxwait;
%sysexec "header rows.xls";
which writes out a sample of 50 lines from a file 100 records apart -
putting the var names and some sample data into a quick Excel file - I
use this all the time - looking at foreign files on the fly.
I also keep a list of my common formats that aren't automatically
loaded under "fmt"
%inc fmt($account.sas);
Account=acct2cd||'-'||put(acct2cd, $account.);
%inc fmt($acct2cd.sas);
Acct2Cd=put(acct2cd, $acct2cd.);
%inc fmt($DESCR.sas);
Service=PUT(SVSCD,$DESCR.);
length SVSCD $56;
SvsCd=trim(SVSCD)||'-'||PUT(SVSCD,$DESCR.);
%inc fmt(RCABRV.sas);
RC=PUT(REGCRT,RCABRV.);
%inc fmt(REGCRT.sas);
RC=PUT(REGCRT,REGCRT.);
%inc fmt($RCABRV.sas);
length RC $6;
RC=PUT(RC,$RCABRV.);
%inc fmt($FY.sas);
length FY $7;
FY=PUT(FY,$FY.);
%inc fmt(ResDtl.sas);
Residence=put(restyp,z2.)||'-'||put(restyp,resdtl.);
%inc fmt($asbud.sas $budcat.sas);
set pos.dfy0506(keep=acct2cd svscd);
BudCat=put(acct2cd||svscd, $asbud.);
BudgetCategory=put(BudCat,$budcat.);
And I also have special programs I keep that do a binary tree search
on my sorted but unindexed files - I get to them with "lkup"
rsubmit;
*needs UCI or Vendor file;
data uci; infile cards dlm=' '; length uci $7; input uci @@; cards;
6140784 6147458 6296801 6564447 6595186 6595819 6603732 6714112
6715853 6716505 6801640 7110803 7292714 7306850 7310077 7540917
;
%inc fmt(lkupCMF);
%inc fmt(lkupCDER);
%inc fmt(lkupESR);
%let fy=0708;
%inc fmt(lkupPOS);
%inc fmt(lkupVndr);
%inc fmt(lkupVAll);
run; endrsubmit;
I have several more - but you get the idea. Anything used on a daily
or weekly basis that I don't want to type out or memorize syntax
for.
This all supplements a growing library of 400+ SAS syntax snippets I
keep as SAS program files - it's about 50/50 homegrown or snatched
from SAS-L. All sorts of goodies like chunks of macro code, datastep
examples like five or six forms of DoW loops, syntax for a dozen or so
SQL joins and queries, ODS examples, DDE examples, etc. Together
with the abbreviations about 3/4 of what I do is canned - saves tons
of time and energy.
hth - Paul Choate
On Feb 15, 10:14 am, matt.pet...@THOMSON.COM (Matt Pettis) wrote:
> Hi,
>
> I've been training some people at work and decided to give them the keyboard
> abbreviations I use to speed up my programming and train them on it. I was
> curious how many other people take advantage of this SAS GUI option and, if
> they do, what abbreviations they use.
>
> A few of the abbreviation I use frequently in my code and what they resolve
> to follows...
>
> abbreviation: comm
> used for: comments that break the code into sections.
> text substitution:
>
> /*--------------------------------------------------------------------*\
>
> \*--------------------------------------------------------------------*/
>
> abbreviation: sum
> used for: getting a 'proc summary' skeleton to work with.
> text substitution:
>
> proc summary data=work nway missing;
> class ;
> var ;
> output out=temp(drop=_:) sum=;
> run;
>
> abbreviation: gpl
> used for: getting a 'proc glplot' skeleton that I most often use.
> text substitution:
>
> goptions reset=symbol reset=axis reset=legend;
> proc gplot data=temp;
> symbol1
> i=j
> w=2
> ;
> axis1
> value=(a=90 r=0)
> ;
> axis2
> label=(a=90 r=0)
> ;
> legend1
> label=('Legend')
> ;
> plot /
> haxis=axis1
> vaxis=axis2
> vzero
> legend=legend1
> overlay
> ;
> run;
> quit;
|