LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Oct 2001 16:40:56 -0400
Reply-To:     Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject:      Re: Automatic calculation of accounts adding ?
Comments: To: Philippe Montigny <philippe.montigny@FREE.FR>
Content-Type: text/plain; charset="iso-8859-1"

Philip,

Try,

/* assumptions: Ident is character variable consisting of digits file is in ident order ident(j) is part of ident(i) whenever ident(j) begins with ident(i) missing values are to be replaced with the sum of its parts. */

data w ; input Ident $ X ; cards ; 1 . 10 50 1008 10 11 . 111 1 112 1 113 1 12 2 2 . 21 10 22 10 23 1 ;

data fix ( keep = ident oldx totx ) ; set w ( rename = ( x = oldx )) nobs = nobs ; cp = _n_ ; totx = oldx ; do pt = cp + 1 to nobs ; set w ( rename = ( ident = ptident ) ) point = pt ; ptident = substr(ptident,1,length(ident)) ; if ptident > ident then leave ; totx + x ; end ; run ;

If you do not like it in this form then try baking the DO-loop conditional on OLDX = . In this case assign TOTX = 0 after the test but before the loop. The first case allows the test data as I gave it with a container not necessarily missing. The suggested changed works with the data you gave and assumes all containers have X missing.

IanWhitlock@westat.com

-----Original Message----- From: Philippe Montigny [mailto:philippe.montigny@FREE.FR] Sent: Monday, October 08, 2001 5:44 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Automatic calculation of accounts adding ?

Hello with all, Beginning on SAS (and in English also;-)), I have a hierarchical table of the type : Ident X 1 . 11 . 111 1 112 1 113 1 12 2 2 . 21 10 22 10 23 1 ......... The missing data are adding accounts which I wish to bring up to date with the opening of the table, and with each modification of one of the accounts of detail. How can I carry out this operation under SAS ? Thank you by advance! Philippe


Back to: Top of message | Previous page | Main SAS-L page