|
I'm not sure either. Can you supply a sample data set before and then after (with the results you want).
*****************************
Lewis Jordan
Weyerhaeuser:
Southern Timberlands R&D
Cell (Primary): 662-889-4514
Office: 662-245-5227
lewis.jordan@weyerhaeuser.com
*****************************
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Dan Abner
Sent: Thursday, February 16, 2012 3:47 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Manually creating cum freqs and percents XXXX
Hello everyone,
I have the following. I am getting missing values for CUM_FREQ and
CUM_PERCENT where DIFF > 0. Any ideas? (BTW, normally I would use PROC
FREQ, but here I want cum values for a subgroup compared to a whole.
If there is a easy way to do this in FREQ, I would like to hear about
it).
DATA T2;
SET T1;
PERCENT = COUNT / 708739;
IF MISSING(DIFF) THEN DO;
CALL MISSING(CUM_FREQ);
CALL MISSING(CUM_PERCENT);
END;
IF DIFF = 0 THEN DO;
CUM_FREQ = COUNT;
CUM_PERCENT = PERCENT;
END;
IF DIFF > 0 THEN DO;
CUM_FREQ = COUNT + LAG(CUM_FREQ);
CUM_PERCENT = PERCENT + LAG(CUM_PERCENT);
END;
RUN;
|