Convert Menu Data Sets to Procedure Format
/****************************************************************/
/* S A S S A M P L E L I B R A R Y */
/* */
/* NAME: ISHMTOP */
/* TITLE: Convert Menu Data Sets to Procedure Format */
/* PRODUCT: QC */
/* SYSTEM: ALL */
/* KEYS: Ishikawa Diagrams, */
/* PROCS: ISHIKAWA */
/* DATA: */
/* */
/* REF: */
/* MISC: This macro converts the data sets used by the */
/* Ishikawa macro program and menu system into a data */
/* set that can be used by the Ishikawa procedure. */
/* */
/* The argument to the macro is a name for the data */
/* set generated by the macro. Use this data set as */
/* input into the Ishikawa procedure. */
/* */
/* The macro assumes that the data sets DEFAULT, */
/* CAUSES, and EFFECT exist in your WORK directory. */
/* */
/* Ex: %mtop( fishbone ); */
/* */
/* proc ishikawa data=fishbone; run; */
/* */
/****************************************************************/
%macro mtop( ds );
data _null_;
set default;
call symput( 'angle', angle );
call symput( 'blength', blength );
call symput( 'slength', slength );
call symput( 'llength', llength );
call symput( 'dfltcol', dfltcol );
run;
data &ds;
set effect ( rename = ( color = _LCOLOR_
t1 = _TEXT1_
t2 = _TEXT2_
t3 = _TEXT3_
t4 = _TEXT4_
t5 = _TEXT5_ ) )
causes ( rename = ( bsl = _TYPE_
side = _SIDE_
length = _RELLNG_
pct = _RELPOS_
color = _LCOLOR_
text1 = _TEXT1_
text2 = _TEXT2_ ) );
drop fromx tox y shrinkx shrinky font fill textht trunkth;
if _N_ = 1 then do;
if _TEXT3_ = ' ' then do; drop _TEXT3_; end;
if _TEXT4_ = ' ' then do; drop _TEXT4_; end;
if _TEXT5_ = ' ' then do; drop _TEXT5_; end;
_TYPE_ = 'TRUNK';
end;
select ( _TYPE_ );
when ( 'TRUNK' ) _RELLNG_ = tox - fromx;
when ( 'BRANCH' ) _RELLNG_ = &blength;
when ( 'STEM' ) _RELLNG_ = &slength;
when ( 'LEAF' ) _RELLNG_ = &llength;
otherwise delete;
end;
_ANGLE_ = ∠
if _LCOLOR_ = ' ' then _LCOLOR_ = "&dfltcol";
run;
%mend mtop;