f



Re: How to get rid of duplicates without using any group?

On Wed, 11 Jun 2008 19:52:04 -0400, Tom Smith <need_sas_help@YAHOO.COM> wrote:

>I have a dataset as below:
>
>serial    description
>----------------------
>10001     yes
>          no
>          may be
>10001     he
>          she
>          them
>1002      yes
>          no
>          may be
>1002      he
>          she
>          them
>
>How can I get rid of additions duplicate values  for the same serial?
>I need only one serial number ( can not do grouping it messes uo the order)
>as below
>
>serial    description
>----------------------
>10001     yes
>          no
>          may be
>          he
>          she
>          them
>1002      yes
>          no
>          may be
>          he
>          she
>          them
>
>Thanks a lot.

Try to maintain a distinction between the design of your data set and the
designs of reports you need to produce.

You need a value of SERIAL in each and every observation.

If order is important for the DESCRIPTION values, and alphabetical order is
not right, you need to explicitly specify that order in a separate variable.

Here is your data set design:

   data need;
   input serial $ desc_order description $6.;
   cards;
   10001    1 yes
   10001    2 no
   10001    3 may be
   10001    4 he
   10001    5 she
   10001    6 them
   1002     1 yes
   1002     2 no
   1002     3 may be
   1002     4 he
   1002     5 she
   1002     6 them
   ;

Then run:

   proc print data=need;
   by serial;
   id serial;
   var description;
   run;

Output:

   serial    description

   10001       yes
               no
               may be
               he
               she
               them

   1002        yes
               no
               may be
               he
               she
               them
0
hs
6/12/2008 1:06:33 AM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

0 Replies
392 Views

Similar Articles

[PageSpeed] 3

Reply:

Similar Artilces:

Re: How to get rid of duplicates without using any group? #2
Thank you Howard. Unfortunately Proc print is not going to work for me. Either I have to create a dataset like the output or have to use proc report. Because whatever you see as the sample output will be a part of large proc report output. ...

Re: How to get rid of duplicates without using any group? #3
Tom, I agree with Howard that you really ought to reconsider your database design. However, that said, here is a way to do what I think you want: data have (drop=last_serial); infile cards missover; retain last_serial; input @1 serial $5. @11 description $6.; if serial eq last_serial then call missing(serial); if not(missing(serial)) then last_serial=serial; cards; 10001 yes no may be 10001 he she them 1002 yes no may be 1002 he she them ; HTH, Art ---------- On Wed, 11 Jun 2008 19:52:04 -0400, Tom Smith <need_sas_help@YAHOO.COM> wrote: >I have a dataset as below: > >serial description >---------------------- >10001 yes > no > may be >10001 he > she > them >1002 yes > no > may be >1002 he > she > them > >How can I get rid of additions duplicate values for the same serial? >I need only one serial number ( can not do grouping it messes uo the order) >as below > >serial description >---------------------- >10001 yes > no > may be > he > she > them >1002 yes > no > may be > he > she > them > >Thanks a lot. ...

How to get rid of duplicates without using any group?
I have a dataset as below: serial description ---------------------- 10001 yes no may be 10001 he she them 1002 yes no may be 1002 he she them How can I get rid of additions duplicate values for the same serial? I need only one serial number ( can not do grouping it messes uo the order) as below serial description ---------------------- 10001 yes no may be he she them 1002 yes no may be he she them Thanks a lot. On 12 Jun, 00:52, need_sas_h...@YAHOO.COM (Tom Smith) wrote: > I have a dataset as below: > > serial =A0 =A0description > ---------------------- > 10001 =A0 =A0 yes > =A0 =A0 =A0 =A0 =A0 no > =A0 =A0 =A0 =A0 =A0 may be > 10001 =A0 =A0 he > =A0 =A0 =A0 =A0 =A0 she > =A0 =A0 =A0 =A0 =A0 them > 1002 =A0 =A0 =A0yes > =A0 =A0 =A0 =A0 =A0 no > =A0 =A0 =A0 =A0 =A0 may be > 1002 =A0 =A0 =A0he > =A0 =A0 =A0 =A0 =A0 she > =A0 =A0 =A0 =A0 =A0 them > > How can I get rid of additions duplicate values =A0for the same serial? > I need only one serial number ( can not do grouping it messes uo the order= ) > as below > > serial =A0 =A0description > ---------------------- > 10001 =A0 =A0 yes > =A0 =A0 =A0 =A0 =A0 no > =A0 =A0 =A0 =A0 =A0 may be > =A0 =A0 =A0 =A0 =A0 he > =A0 =A0 =A0 =A0 =...

Re: How to use SAS to determine patient group and control group?
Hi Tony, Do the patients in each of your 24 groups already have comparable size, age, gender, etc.? If not then you should develop an algorithm to match patients as good as possible (within limits). But do you really need matched (paired) patients? Can't you do with just two random (unpaired) groups that match on the average? Tell us about your design. Regards - Jim. -- Jim Groeneveld, Netherlands statistician, SAS consultant home.hccnet.nl/jim.groeneveld On Thu, 28 Sep 2006 11:14:00 -0700, Tonywang <tonywolf@YAHOO.COM> wrote: >Hi Guys, > >I have 24 groups of patients ...

Re: Re: Re: Re: Getting the number of rows returned by a select with group by.
Let the world know your discovery... Chucho! -----Original Message----- From: rkusenet <rkusenet@gmail.com> To: Jean Sagi <jeansagi@myrealbox.com> Date: Thu, 23 Sep 2004 15:58:11 -0400 Subject: Re: Re: Re: Getting the number of rows returned by a select with group by. Yes I believe there should be no problem if derived tables (TABLE(MULTISET)) is used since technically we are not creating/dropping an object inside a SP. I was forced to find other workarounds for the SP problem by using real tables as global temp tables with SESSIONID column to link it to the session. Much less elegant than this. However I am not sure how good the performance of derived tables. I will try to do a bench mark. On Thu, 23 Sep 2004 14:45:25 -0500, Jean Sagi <jeansagi@myrealbox.com> wrote: > > Besides... > > Let say you call stored procedure for every row in a query, _and_ inside the stored procedure you create and drop a temporary table... > > I had a lot of problems doing this, unitl someone give a solution to this by using exceptions... > > I think no problem exist by using _derived tables_ > . > > Chucho! > > -----Original Message----- > From: "rkusenet" <rkusenet@gmail.com> > .. The problem comes in stored procedures where creation/destruction of a temp table inside the SP forces the engine to recompile, which in turn puts a lock on sysprocplan... > > ...

Re: how to get rid of square symbol in my sas dataset
Patrick, Thanks a lot. Ascii worked like a magic. I was using a default ftp before. Thanks. On Thu, 7 Aug 2008 14:14:19 -0700, Patrick <patrick.matter@GMX.CH> wrote: >Hi Hari >Have a look at the tread "removing hidden characters" from today. >Regards >Patrick > >P.S: Are you ftp'ing BIN or ASCII? Try ASCII and have a look if this >square still exists. ...

Re: generating consecutive integers for each group using SAS
> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of oercim > Sent: Tuesday, September 02, 2008 12:33 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: generating consecutive integers for each group using SAS > > hello. I have a problem. Using SAS programming I want to do that: I > have such a data column(let labeled 'A'): > A > --- > a > a > a > b > b > b > b > c > d > d > Now, I want to generate consecutive integers for each group such > that > A B > --- ---------- > a 1 > a 2 > a 3 > b 1 > b 2 > b 3 > b 4 > c 1 > d 1 > d 2 > how can i generate this integers using SAS programming? thanks a lot *create sample data; data have; input A $; cards; a a a b b b b c d d ; run; *create new variable and dataset; data want; set have; by A; if first.A then B=1; else B+1; run; proc print; run; Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA ...

Re: How to get used CPU time in a SAS datastep
Dear SAS-L-ers, Michael Weiss posted the following: > I would like to make some tests about performance of SAS > applications. For these tests, I need to measure the consumed > CPU-Time of a bunch of proc and data steps. > > I would do something like: > > data myTime; > startT=datetime(): > startCPU=usedCPUTime(); > run; > > /* here will be the proc and data steps to measure */ > > data myTime; > set myTime; > endT = datetime(): > endCPU = usedCPUTime(); > durationT = endT - startT; > durationC...

Re: Re: Re: Getting the number of rows returned by a select with group by.
? -----Original Message----- From: "Obnoxio The Clown" <obnoxio@serendipita.com> To: "rkusenet" <rkusenet@gmail.com> Date: Thu, 23 Sep 2004 21:40:50 +0100 (BST) Subject: Re: Re: Getting the number of rows returned by a select with group by. rkusenet said: > "Jean Sagi" <jeansagi@myrealbox.com> wrote in message > news:civ3ov$np5$1@news.xmission.com... >> >> Hey, >> >> This works on 9.3, !! Really cool! >> >> Usually I insert the result into a temporary table and then count it or >> If using 4gl I access > sqlca or if using dbaccess i unload to a temporary file and look for the > number of unloaded rows... >> >> Sorry it doesn't work on 7.31... > > works in 9.21 too. > > Wow !!! this is COOOOOOOL. > > I never thought I could clone DERIVED tables (as it is called in SQL > Server) > using TABLE (MULTISET). <sigh> Maybe now all that OR malarkey will catch on as well! -- Bye now, Obnoxio "C'est pas parce qu'on n'a rien � dire qu'il faut fermer sa gueule" - Coluche "I'm trying to see things your way, but I can't get my head up my ass" - JCH "Ogni uomo mi guarda come se fossi una testa di cazzo" - Marco http://www.catb.org/~esr/faqs/smart-questions.html sending to informix-list Jean Sagi jeansagi@myrealbox.com ...

RE: [Info-ingres] Re: Is it possible to use OpenIngres gateway to access Sybase without using cursors?
"DBG" <tore.aasgaard@gmail.com> wrote in message > Hi > > Im administering a Sybase database. The application accessing this > database was originally developed for Ingres, so now the application > which is developed using Ingres OpenRoad is communicating with my > Sybase database via an OpenIngres gateway (Enterprise access I think > is the name). > I've have performance issues with my database, (table locking, high > number of small I/O etc) and from what I can gather this is in my case > related to the use of cursors gateways part. We experienced a lot of locking problems in EA/MSSQL until I put this in the start up code: SELECT :lv_server_class = dbmsinfo('server_class'); IF lv_server_class = 'MSSQL' THEN DIRECT EXECUTE IMMEDIATE 'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED'; COMMIT; DIRECT EXECUTE IMMEDIATE 'SET LOCK_TIMEOUT 10000'; COMMIT; ELSEIF lv_server_class = 'Ingres DBMS Server' THEN SET lockmode session WHERE readlock = nolock, timeout = 10; COMMIT; ELSE MESSAGE 'Warning server class ' + lv_server_class + ' not implemented'; ENDIF; "Paul White" <pwhite@peerlessit.com.au> wrote in message news:mailman.1111701677.22482.info-ingres@cariboulake.com... > We experienced a lot of locking problems in EA/MSSQL until I put this in ...

Re: generating consecutive integers for each group using SAS #2
Hi, hope the below code would help you. data have; input A $1.; cards; a a a b b b b c d d ; run; proc sort data=Have;by Z;Run; data want; set have; By A; Retain B 0; B+1; output; If last.A then B=0; Run; -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of oercim Sent: Tuesday, September 02, 2008 1:03 PM To: SAS-L@LISTSERV.UGA.EDU Subject: generating consecutive integers for each group using SAS hello. I have a problem. Using SAS programming I want to do that: I have such a data column(let labeled 'A'): A --- a a a b b b b c d d Now, I want to generate consecutive integers for each group such that A B --- ---------- a 1 a 2 a 3 b 1 b 2 b 3 b 4 c 1 d 1 d 2 how can i generate this integers using SAS programming? thanks a lot I'm wondering, is this doable using Proc SQL or any other procedures, except datastep? Thanks! Akshaya ...

Re: generating consecutive integers for each group using SAS #4
On Tue, 2 Sep 2008 14:53:12 -0700, Jack Hamilton <jfh@STANFORDALUMNI.ORG> wrote: >Yes, you can generate consecutive integers using the undocumented >function MONOTONIC, or using the RESOLVE function with a macro. > >===== >%macro increment_counter(varname); > %global &VARNAME.; > %let &VARNAME = %eval(&&&VARNAME. + 1); > &&&VARNAME. >%mend increment_counter; > >proc sql; > create table classplus as > select > monotonic() as seq1, > input(resolve('%INCREMENT_COUNTER(classplusvar)'), best.) > as seq2, > * > from > sashelp.class > ; >quit; >===== > >The monotonic function will, in general, start over at 1 in each query; >the RESOLVE approach will remember the last value from its previous >execution unless you reset it. > Akshaya did not indicate what "this" is. I believe the original poster wanted to restart the counter for each group. Here is a solution based on MONOTONIC(): data have; input A $; cards; a a a b b b b c d d ; proc sql; create table mm as select *, monotonic () as M from have; create table want as select *, m + 1 - min(m) as B from mm group by a order by m ; quit; Result: A M B ---------------------------- a 1 1 a ...

Re: How to create family tree like grouping using SAS
search my posts or Changchun's posts on L-archives, then you will find solutions to similar problems On Mon, 3 Aug 2009 20:31:58 -0700, John Lu <loginon@GMAIL.COM> wrote: >I have a table with 2 persons and a relation description at each row. >A sample data can looked like below: > >data relation; >input id1 id2 relation $3.; >datalines; >1 2 H-W >2 1 W-H >1 3 F-S >2 3 M-S >1 11 F-D >11 1 D-F >3 4 H-W >4 5 M-D >4 6 D-M >7 6 H-W >6 7 W-H >7 8 F-S >8 6 S-M >9 10 H-W >; >run; > >Each person can have one of the 6 i...

Re: generating consecutive integers for each group using SAS #3
Yes, you can generate consecutive integers using the undocumented function MONOTONIC, or using the RESOLVE function with a macro. ===== %macro increment_counter(varname); %global &VARNAME.; %let &VARNAME = %eval(&&&VARNAME. + 1); &&&VARNAME. %mend increment_counter; proc sql; create table classplus as select monotonic() as seq1, input(resolve('%INCREMENT_COUNTER(classplusvar)'), best.) as seq2, * from sashelp.class ; quit; ===== The monotonic function will, in general, start over at 1 in each query; the RESOLVE approach will remember the last value from its previous execution unless you reset it. On Tue, 2 Sep 2008 09:48:15 -0700, "Akshaya" <akshaya.nathilvar@GMAIL.COM> said: > I'm wondering, is this doable using Proc SQL or any other procedures, > except datastep? > > Thanks! > Akshaya -- Jack Hamilton Sacramento, California jfh@alumni.stanford.org <== Use this, not jfh@stanfordalumni.org ...

Re: How to get Rid of Tab or Eof markers from Excel sheet to SAS
On Fri, 29 Feb 2008 12:37:27 -0500, SAS_learner <proccontents@GMAIL.COM> wrote: >Hello guys, > >I am Importing an Excel file using SAS 9. The excel File I think has lot of >Tab's or Line feeds or some things resulting in having funny characters in >the dataset. They are usually at the end of Line (Box's ). How do I can get >rid of them. > >For Example a Field in Excel has >Day 1 >Post-op- No VAS performed > > >I am getting a weired character at the end of the Day 1 > >thanks Try (not tested): Day_1 = compress( Day_1 , ' '...

Re: Getting rid of "the SAS System" output text
title; --> Removes all previously assigned titles, including the SAS default. On Wed, Mar 4, 2009 at 9:49 AM, aj <alan.weiner@wdc.usda.gov> wrote: > The titiel "the SAS System" appears about each one of my output > tables. How would I remove that? > -- AkshayA! ...

Re: How to get Rid of Tab or Eof markers from Excel sheet to SAS #4
On Fri, 29 Feb 2008 13:40:31 -0500, SAS_learner <proccontents@GMAIL.COM> wrote: >Thanks Howard Yes that helped in eliminating the unwanted characters but >also took away the Space . > >Is something Possible with Transward Function or any other similar Function >where I can change the Unprintable character into a Space . Here's a way to leverage the TRANSLATE function with features of the COMPRESS function. data _null_; messy = 'ab ' || 'fe09'x || ' cd'; clean1 = translate(messy,' ',compress(collate(0),, 'w')); clea...

Using "uniq" or something different to get rid of duplicate lines.
Hi all, Does anyone know the best way to get rid of "duplicate" lines that have ONLY 1 field in common? My file looks something like this: aaaa,1234,cccc bbbb,1234,dddd aaaa,1234,bbbb www,1234,tttttt aaaa,2345,tttttt bbbb,2345,oooo aaaa,2345,bbbb The file is delimited using a "," and I need to leave one line only with 1234 and another line only with 2345 (it does not matter which one). Any ideas? Thanks, BTNA btna wrote: > Hi all, > > Does anyone know the best way to get rid of "duplicate" lines that > have ONLY 1 field in common? My file looks...

Re: How to get Rid of Tab or Eof markers from Excel sheet to SAS #5
Thanks Howard, for the Tip i will Play around Your code and let you Know . thanks On Fri, Feb 29, 2008 at 11:15 PM, Howard Schreier <hs AT dc-sug DOT org> < schreier.junk.mail@gmail.com> wrote: > On Fri, 29 Feb 2008 13:40:31 -0500, SAS_learner <proccontents@GMAIL.COM> > wrote: > > >Thanks Howard Yes that helped in eliminating the unwanted characters but > >also took away the Space . > > > >Is something Possible with Transward Function or any other similar > Function > >where I can change the Unprintable character into a Space . >...

Re: Get data in Using Input: Log has SAS went to a new line when
This is becoz of two blank lines one at the top and the other at the bottom, Input stmt is forced to read past the end of the current record and moves the pointer to the first column of next record. Caused by Flowover-- the default behavior for input stmts. On Wed, Feb 25, 2009 at 1:14 PM, SUBSCRIBE SAS-L Dan <deniseyu001@gmail.com>wrote: > Hi. SasLers: > > Please help to clarify this to me. Thanks. > > My code is as below: > > data fltdest ; > input Flight $ Destination $20. ; > put _all_ ; > datalines ; > > 145 Brussels > 145 Edmonton > 150 Paris > 150 Madrid > 165 Seattle > > ; > run; > > proc print ; run; > > The log give this > > "NOTE: SAS went to a new line when INPUT statement reached past the end of > a line." > -- AkshayA! ...

Re: Get data in Using Input: Log has SAS went to a new line when #2
....you can avoid this by eg: data fltdest ; infile datalines truncover; input Flight $ Destination $20. ; put _all_ ; datalines ; 145 Brussels 145 Edmonton 150 Paris 150 Madrid 165 Seattle ; run; There are also some other possible options, like missover, ... which does nearly the same. Gerhard On Wed, 25 Feb 2009 14:10:48 -0500, Akshaya Nathilvar <akshaya.nathilvar@GMAIL.COM> wrote: >This is becoz of two blank lines one at the top and the other at the bottom, >Input stmt is forced to read past the end of the current record and moves >the pointer to the first column of next record. Caused by Flowover-- the >default behavior for input stmts. > >On Wed, Feb 25, 2009 at 1:14 PM, SUBSCRIBE SAS-L Dan ><deniseyu001@gmail.com>wrote: > >> Hi. SasLers: >> >> Please help to clarify this to me. Thanks. >> >> My code is as below: >> >> data fltdest ; >> input Flight $ Destination $20. ; >> put _all_ ; >> datalines ; >> >> 145 Brussels >> 145 Edmonton >> 150 Paris >> 150 Madrid >> 165 Seattle >> >> ; >> run; >> >> proc print ; run; >> >> The log give this >> >> "NOTE: SAS went to a new line when INPUT statement reached past the end of >> a line." >> > > > >-- >AkshayA! ...

Re: Get data in Using Input: Log has SAS went to a new line when #3
Thanks. ...

Re: Get meta data of XPT file without converting to SAS dataset #3
Thanks Sig, I was aware of this. But this means that I have to get the list of file names from the folder (probably with pipe), then loop through the list to 'unpack' the files individually. I think the key here is that for XPORT optioned libname, it has to be followed by a file name, NOT a folder name. Ya -----Original Message----- From: Sigurd Hermansen [mailto:HERMANS1@WESTAT.com] Sent: Thursday, October 15, 2009 11:42 AM To: Huang, Ya; SAS-L@LISTSERV.UGA.EDU Subject: RE: Get meta data of XPT file without converting to SAS dataset first? Ya: I haven't work with XPORT engine...

Re: Get meta data of XPT file without converting to SAS dataset #4
Try a wildcard in the libref. libname xx xport "c:\temp\xpt\*.xpt"; assuming the filetype is XPT. On 10/15/09, Ya Huang <ya.huang@amylin.com> wrote: > Hi there, > > Is there an easy way to get all the xpt files meta data in a folder, > without having to 'unpack' them first. The xpt files were created > with XPORT engine. Each SAS dataset (*.sas7bdat) has a cooresponding > xpt file. > > The following won't work: > > libname xx xport "c:\temp\xpt"; > proc contents data=xx._all_; > run; > > Thanks > > Ya >...

Web resources about - Re: How to get rid of duplicates without using any group? - comp.soft-sys.sas

Duplicate bridge - Wikipedia, the free encyclopedia
Duplicate bridge is the most widely used variation of contract bridge in club and tournament play. It is called duplicate because the same bridge ...

Search for duplicate files - Wikipedia, the free encyclopedia
Language: English Home Random Search for duplicate files Search for duplicate files based on hash values. 900 × 600 pixel File size: 377 B MIME ...

How to Duplicate Facebook’s Hacktober
... build and maintain a security-aware culture. Director of security operations Jennifer Henley shared tips for other companies looking to duplicate ...

Facebook adds new duplicate page finder tool for admins to report unofficial pages
Some Facebook page owners are seeing a new “Report Duplicates” module that allows them to search for pages related to their own and report those ...

faroo_p2p: FAROO Search now with robust Near Duplicate Detection. Filters scraped or syndicated content ...
faroo_p2p: FAROO Search now with robust Near Duplicate Detection. Filters scraped or syndicated content. http://t.

Smart Merge - Duplicate Contacts Cleanup for AddressBook Gmail Facebook & Google contacts on the App ...
Read reviews, compare customer ratings, see screenshots, and learn more about Smart Merge - Duplicate Contacts Cleanup for AddressBook Gmail ...

Liberals to duplicate Cotter Road in $25 million plan
Duplication would close a &quot;missing link&quot; through a new 1.7 kilometre upgrade.

How-To: Safely shrink your Mac’s giant photo library, deleting duplicate images to save space
... Apple’s new Photos app , you might be surprised to learn that you’ve lost a lot of hard drive space, and that there are suddenly tons of duplicate ...

How to Fix Duplicate Content and Improve Your SEO
How to Fix Duplicate Content and Improve Your SEO Business 2 Community In 2013, Matt Cutts stated that 25% of the web was duplicate content, ...


Resources last updated: 3/17/2016 1:27:48 AM