From: Al on 19 Jun 2010 20:42 Dear All: I have this data below data have; input name $ dep $ age marks ; cards; JOHN DMA 30 29 AMAR CLI 29 49 NAGI SAS 11 19 BILL PRO 19 11 JOHN DMA 30 29 AMAR CLI 29 49 JOHN DMA 00 00 ; run; This the dataset i want NAGI SAS 11 19 BILL PRO 19 11 JOHN DMA 00 00 i.e remove all the data points which have the same key values name,dep,age and marks .. i want all the data points to be removed. JOHN DMA 30 29 JOHN DMA 30 29 AMAR CLI 29 49 AMAR CLI 29 49 I have tried using proc sort with nodupkey but this problem i am not able to get to this data set .. NAGI SAS 11 19 BILL PRO 19 11 JOHN DMA 00 00 Thanks in advance Al
From: smileguy on 20 Jun 2010 00:13 On Jun 19, 7:42 pm, Al <ali6...(a)gmail.com> wrote: > Dear All: > > I have this data below > > data have; > input name $ dep $ age marks ; > cards; > JOHN DMA 30 29 > AMAR CLI 29 49 > NAGI SAS 11 19 > BILL PRO 19 11 > JOHN DMA 30 29 > AMAR CLI 29 49 > JOHN DMA 00 00 > ; > run; > > This the dataset i want > > NAGI SAS 11 19 > BILL PRO 19 11 > JOHN DMA 00 00 > > i.e remove all the data points which have the same key values > name,dep,age and marks .. > i want all the data points to be removed. > > JOHN DMA 30 29 > JOHN DMA 30 29 > AMAR CLI 29 49 > AMAR CLI 29 49 > > I have tried using proc sort with nodupkey but this problem i am not > able to get to this data set .. > > NAGI SAS 11 19 > BILL PRO 19 11 > JOHN DMA 00 00 > > Thanks in advance > Al proc sql; create table want as select * from have group by name,dep,age,marks having count(*)=1; quit;
From: Al on 20 Jun 2010 01:15 On Jun 19, 11:13 pm, smileguy <zhangy...(a)gmail.com> wrote: > On Jun 19, 7:42 pm, Al <ali6...(a)gmail.com> wrote: > > > > > > > Dear All: > > > I have this data below > > > data have; > > input name $ dep $ age marks ; > > cards; > > JOHN DMA 30 29 > > AMAR CLI 29 49 > > NAGI SAS 11 19 > > BILL PRO 19 11 > > JOHN DMA 30 29 > > AMAR CLI 29 49 > > JOHN DMA 00 00 > > ; > > run; > > > This the dataset i want > > > NAGI SAS 11 19 > > BILL PRO 19 11 > > JOHN DMA 00 00 > > > i.e remove all the data points which have the same key values > > name,dep,age and marks .. > > i want all the data points to be removed. > > > JOHN DMA 30 29 > > JOHN DMA 30 29 > > AMAR CLI 29 49 > > AMAR CLI 29 49 > > > I have tried using proc sort with nodupkey but this problem i am not > > able to get to this data set .. > > > NAGI SAS 11 19 > > BILL PRO 19 11 > > JOHN DMA 00 00 > > > Thanks in advance > > Al > > proc sql; > create table want as > select * from have > group by name,dep,age,marks > having count(*)=1; > quit; Can this be done using a data step.thanks in advance
From: Barry Schwarz on 20 Jun 2010 13:41 On Sat, 19 Jun 2010 22:15:04 -0700 (PDT), Al <ali6058(a)gmail.com> wrote: >On Jun 19, 11:13�pm, smileguy <zhangy...(a)gmail.com> wrote: >> On Jun 19, 7:42�pm, Al <ali6...(a)gmail.com> wrote: >> >> >> >> >> >> > Dear All: >> >> > I have this data below >> >> > data have; >> > input name $ dep $ age marks ; >> > cards; >> > JOHN DMA 30 29 >> > AMAR CLI 29 49 >> > NAGI SAS 11 19 >> > BILL PRO 19 11 >> > JOHN DMA 30 29 >> > AMAR CLI 29 49 >> > JOHN DMA 00 00 >> > ; >> > run; >> >> > This the dataset i want >> >> > NAGI SAS 11 19 >> > BILL PRO 19 11 >> > JOHN DMA 00 00 >> >> > i.e remove all the data points which have the same key values >> > name,dep,age and marks .. >> > i want all the �data points to be removed. >> >> > JOHN DMA 30 29 >> > JOHN DMA 30 29 >> > AMAR CLI 29 49 >> > AMAR CLI 29 49 >> >> > I have tried using proc sort with nodupkey but this problem �i am not >> > able to get to this data set .. >> >> > NAGI SAS 11 19 >> > BILL PRO 19 11 >> > JOHN DMA 00 00 >> >> > Thanks in advance >> > Al >> >> proc sql; >> create table want as >> �select * from have >> � � � � group by name,dep,age,marks >> � � � � �having count(*)=1; >> quit; > >Can this be done using a data step.thanks in advance Sort by name, dep, age, and marks. In a data step, use a subsetting if statement that checks both first.marks and last.marks. -- Remove del for email
From: gupt on 21 Jun 2010 06:19 On Jun 20, 10:41 pm, Barry Schwarz <schwa...(a)dqel.com> wrote: > On Sat, 19 Jun 2010 22:15:04 -0700 (PDT), Al <ali6...(a)gmail.com> > wrote: > > > > >On Jun 19, 11:13 pm, smileguy <zhangy...(a)gmail.com> wrote: > >> On Jun 19, 7:42 pm, Al <ali6...(a)gmail.com> wrote: > > >> > Dear All: > > >> > I have this data below > > >> > data have; > >> > input name $ dep $ age marks ; > >> > cards; > >> > JOHN DMA 30 29 > >> > AMAR CLI 29 49 > >> > NAGI SAS 11 19 > >> > BILL PRO 19 11 > >> > JOHN DMA 30 29 > >> > AMAR CLI 29 49 > >> > JOHN DMA 00 00 > >> > ; > >> > run; > > >> > This the dataset i want > > >> > NAGI SAS 11 19 > >> > BILL PRO 19 11 > >> > JOHN DMA 00 00 > > >> > i.e remove all the data points which have the same key values > >> > name,dep,age and marks .. > >> > i want all the data points to be removed. > > >> > JOHN DMA 30 29 > >> > JOHN DMA 30 29 > >> > AMAR CLI 29 49 > >> > AMAR CLI 29 49 > > >> > I have tried using proc sort with nodupkey but this problem i am not > >> > able to get to this data set .. > > >> > NAGI SAS 11 19 > >> > BILL PRO 19 11 > >> > JOHN DMA 00 00 > > >> > Thanks in advance > >> > Al > > >> proc sql; > >> create table want as > >> select * from have > >> group by name,dep,age,marks > >> having count(*)=1; > >> quit; > > >Can this be done using a data step.thanks in advance > > Sort by name, dep, age, and marks. > > In a data step, use a subsetting if statement that checks both > first.marks and last.marks. > > -- > Remove del for email data have; input name $ dep $ age marks ; cards; JOHN DMA 30 29 AMAR CLI 29 49 NAGI SAS 11 19 BILL PRO 19 11 JOHN DMA 30 29 AMAR CLI 29 49 JOHN DMA 00 00 ; run; proc sort data=have out=have1; by name dep age marks; run; data have2 have3; set have1; by name; if first.name=1 and last.name=1 then output have2; else output have3; run; proc sql; create table final as select distinct * from have3; quit;
|
Pages: 1 Prev: A faster way to do what this line of code does Next: Import Excel - DBMS |