Prev: Business Development Manager / Centre Head with ASSYST @ Kolkata.
Next: SAS: decimal place issues
From: bigD on 3 Jun 2010 10:08 Hi All, I have what I thought was an easy problem, but clearly I don't understand the do until loop. I need to delete _only_ 87 records from a data set if they satisfy a certain condition (length between 13 and 500). I tried the code below , but it the code is deleting all the records. data b_until; set b; n=0; do until (n=87); if 13<=length <=500 then delete; n=n+1; end; run; Then I tried the code below, and it locks up SAS. data b_until; set b; n=0; do until (n=87); if 13<= alc_los <=500 then true=1; if true=1 then do; delete; n+1; end; end; run; Thanks for your help. BigD.
From: Ya on 3 Jun 2010 11:25 Can you try this? data b_until; set b; n=0; do until (n=87); if 13<=length <=500 then do; n=n+1; delete; end; end; run; On Jun 3, 7:08 am, bigD <diaphanos...(a)gmail.com> wrote: > Hi All, > > I have what I thought was an easy problem, but clearly I don't > understand the do until loop. > I need to delete _only_ 87 records from a data set if they satisfy a > certain condition (length between 13 and 500). > I tried the code below , but it the code is deleting all the records. > > data b_until; > set b; > n=0; > do until (n=87); > if 13<=length <=500 then delete; > n=n+1; > end; > run; > > Then I tried the code below, and it locks up SAS. > > data b_until; > set b; > n=0; > do until (n=87); > if 13<= alc_los <=500 then true=1; > if true=1 then do; > delete; > n+1; > end; > end; > run; > > Thanks for your help. > > BigD.
From: bigD on 3 Jun 2010 11:39 Locks up the data step. On Jun 3, 11:25 am, Ya <huang8...(a)gmail.com> wrote: > Can you try this? > > data b_until; > set b; > n=0; > do until (n=87); > if 13<=length <=500 then do; > n=n+1; > delete; > end; > end; > run; > > On Jun 3, 7:08 am, bigD <diaphanos...(a)gmail.com> wrote: > > > Hi All, > > > I have what I thought was an easy problem, but clearly I don't > > understand the do until loop. > > I need to delete _only_ 87 records from a data set if they satisfy a > > certain condition (length between 13 and 500). > > I tried the code below , but it the code is deleting all the records. > > > data b_until; > > set b; > > n=0; > > do until (n=87); > > if 13<=length <=500 then delete; > > n=n+1; > > end; > > run; > > > Then I tried the code below, and it locks up SAS. > > > data b_until; > > set b; > > n=0; > > do until (n=87); > > if 13<= alc_los <=500 then true=1; > > if true=1 then do; > > delete; > > n+1; > > end; > > end; > > run; > > > Thanks for your help. > > > BigD.
From: a on 3 Jun 2010 11:48 On Jun 3, 9:08 am, bigD <diaphanos...(a)gmail.com> wrote: > Hi All, > > I have what I thought was an easy problem, but clearly I don't > understand the do until loop. > I need to delete _only_ 87 records from a data set if they satisfy a > certain condition (length between 13 and 500). > I tried the code below , but it the code is deleting all the records. > > data b_until; > set b; > n=0; > do until (n=87); > if 13<=length <=500 then delete; > n=n+1; > end; > run; > > Then I tried the code below, and it locks up SAS. > > data b_until; > set b; > n=0; > do until (n=87); > if 13<= alc_los <=500 then true=1; > if true=1 then do; > delete; > n+1; > end; > end; > run; > > Thanks for your help. > > BigD. This will never work like you think I does becasue DELETE has an implied RETURN that returns control to the top of the step. Show example data and explain what you want to do.
From: Arthur Tabachneck on 3 Jun 2010 11:59 Are you trying to do something like:? data b_until; set b; if 13<=length <=500 then do; n+1; if n < 87 then delete; end; run; Art ------------- On Jun 3, 11:39 am, bigD <diaphanos...(a)gmail.com> wrote: > Locks up the data step. > > On Jun 3, 11:25 am, Ya <huang8...(a)gmail.com> wrote: > > > > > Can you try this? > > > data b_until; > > set b; > > n=0; > > do until (n=87); > > if 13<=length <=500 then do; > > n=n+1; > > delete; > > end; > > end; > > run; > > > On Jun 3, 7:08 am, bigD <diaphanos...(a)gmail.com> wrote: > > > > Hi All, > > > > I have what I thought was an easy problem, but clearly I don't > > > understand the do until loop. > > > I need to delete _only_ 87 records from a data set if they satisfy a > > > certain condition (length between 13 and 500). > > > I tried the code below , but it the code is deleting all the records. > > > > data b_until; > > > set b; > > > n=0; > > > do until (n=87); > > > if 13<=length <=500 then delete; > > > n=n+1; > > > end; > > > run; > > > > Then I tried the code below, and it locks up SAS. > > > > data b_until; > > > set b; > > > n=0; > > > do until (n=87); > > > if 13<= alc_los <=500 then true=1; > > > if true=1 then do; > > > delete; > > > n+1; > > > end; > > > end; > > > run; > > > > Thanks for your help. > > > > BigD.- Hide quoted text - > > - Show quoted text -
|
Next
|
Last
Pages: 1 2 Prev: Business Development Manager / Centre Head with ASSYST @ Kolkata. Next: SAS: decimal place issues |