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 (February 2005, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 23 Feb 2005 11:12:03 -0500
Reply-To:   Nathaniel_Wooding@DOM.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject:   Re: Compound
Comments:   To: Thomas <tythong@YAHOO.COM>
Content-type:   text/plain; charset=US-ASCII


Here is a solution which appears to meet your needs. I have commented out a couple lines which you don't need plus I added a where statement which discards cases of cret= -1. This discarding needs to happen before SAS sets up the first. variable value. Otherwise, your assigment and if statements may not work properly.

Nat Wooding

data mret;

input COID $ YR MON CRET ; format cret 14.11; *if cret; * get rid of the missing cret lines before you get to a data step with first.mon; cards; 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 . 26880N 2003 03 1.0459851132 26880N 2003 03 0.9772717489 26880N 2003 03 0.9767431378 26880N 2003 03 1 26880N 2003 03 0.9517978982 26880N 2003 03 0.9749986978 26880N 2003 03 1.0964602662 26880N 2003 03 0.9529324891 26880N 2003 03 1.0470675109 26880N 2003 03 0.9529324891 proc print; DATA MRET2; SET MRET (where =(cret ne .)); BY COID YR MON; RETAIN MRET; *IF CRET^=. THEN DO; IF FIRST.MON THEN MRET=CRET; ELSE mret=MRET*CRET; IF LAST.MON THEN OUTPUT; * END; RUN; proc print;



Thomas <tythong@YAHOO.CO To: SAS-L@LISTSERV.UGA.EDU M> cc: Sent by: "SAS(r) Subject: Re: Compound Discussion" <SAS-L@LISTSERV.U GA.EDU>

02/23/05 10:54 AM Please respond to Thomas

Thanks Nigel. You are right that I actually would like to compound the CRET with non- missing values, and no matter whether the first observation, observations in the middle, and/or last observation of CRET are missing. May I know how to control all this in one statement? Is it possible to combine the two statements I submitted to the list earlier into one?

Thanks again! Thomas

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