Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AMERBSET

AMERBSET.m

Go to the documentation of this file.
  1. AMERBSET ; IHS/ANMC/GIS - MAKES AGE BIN STRING ;
  1. ;;3.0;ER VISIT SYSTEM;;FEB 23, 2009
  1. ;
  1. SETBIN S ^TMP("AMERAGE",$J)="0:1;2:4;5:12;13:19;20:39;40:59;60:79;80:199"
  1. I $D(^AMER("AGE")) S ^TMP("AMERAGE",$J)=^AMER("AGE")
  1. D LIST
  1. S DIR(0)="YO",DIR("A")="Is this OK",DIR("B")="YES",DIR("?")="" D ^DIR K DIR
  1. D OUT^AMEROUT I $D(AMERQUIT) Q
  1. I "yY"[$E(X) Q
  1. RUN S %="",A=-1 W !!! F L=0:0 D AGE Q:X="" I $D(AMERQUIT) G EXIT
  1. D CLOSE I $D(AMERQUIT) G EXIT
  1. D LIST
  1. EXIT K X,Y,Z,%,I,L,A
  1. Q
  1. ;
  1. AGE ;
  1. S DIR(0)="N",DIR("A")="Enter the starting age of the "_$S(%="":"first",1:"next")_" age group: "
  1. D ^DIR S X=Y I '$T S X=U K DIR
  1. I X=U S AMERQUIT="" Q
  1. I X="" Q
  1. I X?1."?" D HELP G AGE
  1. I X?1.3N,X>A D SET Q
  1. W " ??",*7 G AGE
  1. ;
  1. SET S A=X
  1. I %="" S %=X Q
  1. S %=%_":"_(X-1)_";"_X
  1. Q
  1. ;
  1. CLOSE I %="" Q
  1. GC ;
  1. S DIR(0)="N",DIR("A")="Enter the highest age for the last group: "
  1. D ^DIR S X=Y I '$T S X=U K DIR
  1. I X=U S AMERQUIT="" Q
  1. I X?1."?" D HELP G GC
  1. I X="" S X=199
  1. I X?1.3N,X'<A S %=%_":"_X,^TMP("AMERAGE",$J)=% Q
  1. W " ??",*7 G GC
  1. ;
  1. HELP Q
  1. ;
  1. LIST W !!,"CURRENT AGE GROUPS =>",!
  1. S %=^TMP("AMERAGE",$J)
  1. F I=1:1 S X=$P(%,";",I) Q:X="" W !,$P(X,":")," - ",$P(X,":",2)
  1. W !!
  1. Q