```Date: Tue, 20 Jun 2006 14:18:30 -0400 Reply-To: "Howard Schreier " Sender: "SAS(r) Discussion" From: "Howard Schreier " Subject: Re: A PERCENTAGE QUESTION I think Mark's approach is good if this is an isolated one-off task and there will be no need to do anything else with the given data set. Otherwise I would first convert the data to a more sensible structure. data usable(drop = var : ); set sample; array vv(*) var : ; do i = 1 to dim(vv); measure = input(scan(vv(i),1,'()'),32.); percent = input(scan(vv(i),2,'()'),32.); output; end; run; Output: Obs patinet i measure percent 1 0001 1 35 5.5 2 0001 2 55 1.2 3 0001 3 88 95.7 4 0002 1 6 0.6 5 0002 2 88 2.2 6 0002 3 44 33.5 On Tue, 20 Jun 2006 08:33:53 -0700, Terjeson, Mark (IM&R) wrote: >Hi, > >Here is one of several approaches. Use >the SCAN() function to grab the number >inside the parentheses, use the INPUT() >function to convert that piece to numeric, >compare the numeric value to 3.3 and decide >whether to blank the value or not.... > > > >data sample; > input @1 patinet \$4. > +1 var1 \$8. > +1 var2 \$8. > +1 var3 \$8. > ; >cards; >0001 35 (5.5) 55 (1.2) 88(95.7) >0002 6 (0.6) 88 (2.2) 44(33.5) >; >run; > > >data result; > set sample; > if input(scan(var1,2,'()'),best.) le 3.3 then var1=''; > if input(scan(var2,2,'()'),best.) le 3.3 then var2=''; > if input(scan(var3,2,'()'),best.) le 3.3 then var3=''; >run; > > > > > >Hope this is helpful. > > >Mark Terjeson >Senior Programmer Analyst, IM&R >Russell Investment Group > > >Russell >Global Leaders in Multi-Manager Investing > > > > > > > > > > > > >-----Original Message----- >From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >Rathindronath >Sent: Tuesday, June 20, 2006 8:18 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: A PERCENTAGE QUESTION > > >I have a dataset as follows ( this dataset is just a sample): > >patinet var1 Var2 Var3 >0001 35 (5.5) 55 (1.2) 88(95.7) >0002 6 (0.6) 88 (2.2) 44(33.5) > >where the percentages are in the brackets. I need to get only those >values which has the percentage greater than 3.3. So my Output should >look like: > > >I have a dataset as follows: > >patinet var1 Var2 Var3 >0001 35 (5.5) 88(95.7) >0002 44(33.5) > > >Can anyone tell me how can I do that? ```

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