LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (February 2012, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 16 Feb 2012 14:01:49 -0800
Reply-To:   "Jordan, Lewis" <Lewis.Jordan@WEYERHAEUSER.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Jordan, Lewis" <Lewis.Jordan@WEYERHAEUSER.COM>
Subject:   Re: Manually creating cum freqs and percents XXXX
Comments:   To: Dan Abner <dan.abner99@GMAIL.COM>
In-Reply-To:   <CAPRGo-kbuMoHQL05+O-7ZaTD70yOMvOOsohmMKbWEesWPZA9Zw@mail.gmail.com>
Content-Type:   text/plain; charset="us-ascii"

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;


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