::~:: NOTE: IF YOU REPLY, ALL TEXT FOLLOWING THIS LINE WILL BE IGNORED. Trknum: us6255203 Customer: Uekawa, Kazuaki Sitenum: 0000000000 Company: Phone: OS: unknown Product: base OS Release: Topic: logic Product Rel: unknown Subtopic: TSLevel: <=== Page: 1 === Chris Noto === emailed w/answer === 27Jul2005 13:59:59 ===> Kaz, The following sample program generates the ID value by counting the observations per school. If I have misunderstood your request, please clarify what is required. Regards, Chris ************************************************** data ds1; input school $ student $; cards; A Betty A Fred A Barney A Wilma B George B Judy B Jane ; proc sort; by school; data ds2; set ds1; by school; if first.school then id=1; else id+1; run; proc print; run;