SAS Enterprise Guide Users Asking for functionality available without EG for years

  • Follow


Hi SAS-Lers,

   I just checked out the SAS Forum on Enterprise Guide. It seems some
EG users are asking for functionality that I has existed for non EG
users for at least 10 years. It may be available in EG but I could not
find it.

INSERTING PROC SYNTAX IN YOUR EDITOR

If  I put and 'A' in the prefix area of the old editor and then
highlight 'proc datasets' and hit SHF F9<enter>  the syntax for proc
datasets will inserted after the 'A'  program line. .You have to hit
<enter> after the A. You should see only A in the prefix area.  You
need a command macro %macro proc(afstr1)/cmd; and you need the syntax
as source entries in your sasuser.profile. It is easy to get the
syntax from the help function. I will zip my windows profile and store
it on my site, I don't think that is illegal.

Entry in profile has to be procdatasets.source

SHF F9  store;home;paste;

/* here is the extremely complex SAS command macro */
%macro proc(afstr1)/cmd;
  copy proc&afstr1; /* copy after A in prefix area */
%mend proc;

By the way I think it is possible to remove the <enter> but you would
have to read the clipboard with the macro language. Note the clipboad
does not seem to be available in EG.

I cannot  autocomplete. But I could do some clever highlighting and
command macros to get more data about any key options.

RUNNIG BATCH

Suppose I have just finished a program and it runs interactively and I
want to hit a function key or type 'bat' on the command line to run
the program in UNIX batch.

How to run a SAS program in UNIX Batch

If I hit F9 the following happens ( I just sit an wait)

      1. The old UNIX batch log and list are deleted
      2. The program is promoted to production (moved from development
directory to production directory) Incidentally, I keep validation
code at the end of the program and my promotion tool knows not copy
that code to production. This is very handy.
      3. The <CR> is stripped since production directory is UNIX.
     4. The program is checked into SCCS
     5. The program is run under UNIX batch
    6. The log. list and a very nice logscrub are returned to my
interactive display manager window. . ie. Notepad windows h.h,i.i and
j.j
    7 To change focus to the logscrub  I hit function key cntl H. Cntl
I for list and cntl J for log.

This is not exacly the code I use but it gives you the jest of the
batch process. There is a little more going on with registration and
triple letter acronyms. There is related info in my tips file.

 /*______________________________________________________________*\
 |  e n d   p r o g r a m                                         |
 |________________________________________________________________|
\*                                                              */


/* nothing below this line will be promoted to production */
*~!@#;

%macro runifchanged;

/* we are required to have the full program path in the program header
- this is where I get key information
production program_name=/production/molecule/indication/sdtm/
demog.sas
development program_name=/myhome/utl/als_demog */

rsubmit;
/* unix delete old log and list  */
%utlfkil(&program_name..log);
%utlfkil(&program_name..lst);

/* I have one development windows directory for all my SAS programs
for all projects */
/* I have used this system for about 25 years */
/* basically the development directory has program names like
als_demog.sas(lou gehrigs disease) and the production name is just
demog.sas. &tla  =als and als is a unique token that points to the
correct meta data repository */
/* the TLA is critical because it points to the registry and metadata
repository - I am starting to put code to */
/* build a metadata repository in my tips */

/* ptomote to production */
data _null_;
  infile  "/xxxx/xxxxxl/utl/&tla._%getfyl(&program_name)..sas"
dlm='0a'x;  /* delopment file */
  file "&program_name..sas"; /* production directory */
  input;
  _infile_=compress(_infile_,'0d'x);     /* remove carriage return */
  if index(_infile_,'~!@#') then stop;   /* do not copy code at or
after ~!@# */
  else put _infile_;
run;

/* check into to SCCS */
%utlpromo(&program_name);

/* make sure UNIX PWD is set correctly - probably not needed */
data _null_;
call system("cd %getstm(&program_name)"); /* getstm removes file name
*/
call system("setenv PWD %getstm(&program_name)");
run;

/* run batch */
%sysexec sas %getfyl(&program_name)  -sasuser "/home/&sysuserid" -
autoexec /dev/null;
endrsubmit;

/* return log, list and logscrub  */
%utl_logcurchk(&program_name);


/* Validation snippets only exist in development directory */


proc format;

  value cyc2ded

  1='Cycle 1'

  other='Missing Cycle or Other Cycle';

run;



proc sql;

  create

    table frq as

  select

    study

   ,txusecd

   ,put(cyc,cyc2ded.)    as cycdes

   ,count(distinct pid)  as frq

  from

    &ae(where=( txusecd=:'NOG' and itt=1))

  group

    by study, txusecd, cycdes

;quit;



proc sql;

  create

    table frq as

  select

    trta

   ,txuse

   ,cyc

   ,count(distinct pid)  as frq

  from

    &ae(where=( txusecd=:'DOSED' and itt=1 and cyc=1))

  group

    by trta, txuse, cyc

;quit;



proc freq data=&ae(where=( txusecd=:'DOSED' and itt=1));

format cyc cyc2ded.;

tables study*cyc/list missing;

run;



proc freq data=&ae (where=( txusecd=:'DOSED' and itt=1 and cyc=1));

format cyc cyc2ded.;

*tables study*trta*txuse*txset*cyc/list missing;

*tables trta*txuse*txset*cyc/list missing;

tables agecb;

run;

%mend runifchanged;

I ALSO HAVE SOME PROCESS FLOW MACROS - I THINK I POSTED ONE OF THEM
0
Reply xlr82sas (391) 12/3/2009 6:49:06 AM


0 Replies
221 Views

(page loaded in 0.038 seconds)

Similiar Articles:







7/25/2012 10:52:20 PM


Reply: