f



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.
0
6/11/2008 11:52:04 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

1 Replies
340 Views

Similar Articles

[PageSpeed] 51

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 =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
> =A0 =A0 =A0 =A0 =A0 he
> =A0 =A0 =A0 =A0 =A0 she
> =A0 =A0 =A0 =A0 =A0 them
>
> Thanks a lot.

The following works. I've reproduced your data and added a new
datastep that uses a retain statement and some testing to look for
repeats of the serial (a in my code).
I hope it's what you're looking for.

data a;
infile cards dsd;
input a  b $;
cards;
10001 ,    yes
      ,    no
      ,    may be
10001 ,    he
      ,    she
      ,    them
1002  ,    yes
      ,    no
      ,    may be
1002  ,    he
      ,    she
      ,    them
;
run;

data b;
 set a;
drop copya;
RETAIN copya ;
 if a ne .                and _n_ eq 1 then copya =3D a;
 if a ne . and copya =3D a  and _n_ gt 1 then a =3D .;
 if a ne . and copya ne a              then copya =3D a;
run;

Regards BPD
0
6/12/2008 11:37:05 AM
Reply:

Similar Artilces:

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 ...

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. ...

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...

How to use SAS to determine patient group and control group?
Hi Guys, I have 24 groups of patients with different size, age, gender percent, medical cost etc. and I want to divide those 24 groups into 2 big groups: Patient group and Control group. The two groups should have similiar size, age, gender....etc. Is there anyway we can do this with SAS? Thanks for your help. Tony Tonywang wrote: > Hi Guys, > > I have 24 groups of patients with different size, age, gender percent, > medical cost etc. and I want to divide those 24 groups into 2 big > groups: Patient group and Control group. The two groups should have > similiar size, age, gender....etc. > > Is there anyway we can do this with SAS? > > Thanks for your help. > > Tony > > I am going to assume that you don't already have a variable indicating treatment group and that what you want to do is randomly assign your subjectgs to two different experimental groups. - use the randuni function to assign a value to a numeric variable. - sort your subjects by that variable - take the first 12 to be group one, and the second group to be group 2 - then flip a coin to to determine which group is control (heads=1, tails=2). Not really. You ought to have thought of control and experimental groups before you collected the data. Unless there's something common about some of the 24 groups, you can't arbitray assign them to either of large groups. "Tonywang" <tonywolf@yahoo.com> wrote in message news:11594...

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 ...

Getting Rid of Duplicates
I find that I have duplicate tubes and duplicate brushes (and probably other duplicate images) in my Paint Shop Pro program files. How would I go about deleting them so I can free up some space? TIA JT "jaytea" <jayteadesigns@sbcglobal.net> wrote in message news:1166845931.027572.17520@i12g2000cwa.googlegroups.com... >I find that I have duplicate tubes and duplicate brushes (and probably > other duplicate images) in my Paint Shop Pro program files. > How would I go about deleting them so I can free up some space? > TIA > JT > Reset your cache so that it...

Getting Rid of Duplicates
I find that I have duplicate tubes and duplicate brushes (and probably other duplicate images) in my Paint Shop Pro program files. How would I go about deleting them so I can free up some space? TIA JT "jaytea" <jayteadesigns@sbcglobal.net> wrote in message news:1166845931.027572.17520@i12g2000cwa.googlegroups.com... >I find that I have duplicate tubes and duplicate brushes (and probably > other duplicate images) in my Paint Shop Pro program files. > How would I go about deleting them so I can free up some space? > TIA > JT > Reset your cache so that it...

Just When I Was Getting Used To Using Using
I have a class Packet that contains a nested class Payload and an enumeration: struct Packet { struct Payload { } ; } ; I had gotten into the habit of writing: using Packet::Payload; so I could write: Payload::..blah.. instead of Packet::Payload::..blah I have done this... (gulp) in many, many .cpp files. I tried out the new Visual C++ Express compiler from you-know-who on my source code and got 1000's of error messages: ...\Packet\Packet.cpp(13) : error C2885: 'Packet::Payload': not a valid using-declaration at non-class scope What does the standard say? Is this really illegal as Microsoft says? And if it is illegal, what is the rationale behind making it so? Reference: http://msdn2.microsoft.com/en-us/library/ms177253.aspx -Le Chaud Lapin- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] On 26 Nov 2005 10:06:23 -0500, "Le Chaud Lapin" <unoriginal_username@yahoo.com> wrote: >I have a class Packet that contains a nested class Payload and an >enumeration: > >struct Packet >{ > struct Payload > { > } ; >} ; > >I had gotten into the habit of writing: > >using Packet::Payload; > >so I could write: > >Payload::..blah.. > >instead of > >Packet::Payload::..blah > >I have done this... (gulp) in many, many .cpp files. > >I tried out the new Visual C++ Express compil...

how to use get rid of the for....end function
Hello everybody: I am a quite new learner in Matlab. now i have some problems while i am doing the follow calculations: for i = 1 : 127 dd = F > i-1; capacity = i * sum(dd); total= total + capacity; end i supposed to get the final value of "total", where F is a sparse matrix with the size 15172*15172, then i use function sum to get the value capacity. it did work, however, i wanna make my coding more effective, which means, i want to use other functions instead of using the for...end loops..do any one have some suggestions. in fact, i want to get different matrix d...

how to get rid of following code duplication #2
CL-USER> (defun range (start end) (if (<= start end) (loop for x from start upto end collecting x) (loop for x from start downto end collecting x))) * Bigos <lhu1a6$k9l$1@speranza.aioe.org> : Wrote on Mon, 07 Apr 2014 12:14:16 +0100: | CL-USER> (defun range (start end) | (if (<= start end) | (loop for x from start upto end collecting x) | (loop for x from start downto end collecting x))) (if (<= start end) (loop for x from start upto end collecting x) (range end ...

how to get rid of square symbol in my sas dataset
Hi all, I have a dataset in UNIX which i output as pipe delimiter and then ftp to PC. From pc/sas reading in that dataset and i see in my 'model' variable a weird square symbol(looks like a tab space or not sure). How do i get rid of them. I could not copy that value here. When i print it, i still see that square symbol at the end. Thanks. hari 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. ...

how to get a series of numbers without using a loop?
i want numbers from 0,1,2,3,...........n. how can i obtain this without using a loop? i tried using the formula node, but it gives only the last value even though i wrote it using a for stmt. is there any other way i can get the numbers? thank you. You can use the Ramp Pattern signal generation VI. It is under Analyse>>Signal Processing>>Signal Generation. You say you don't want to use a ramp but you're trying a for loop in a formula node. That doesn't make much sense. A LabVIEW for loop will execute just as fast if not faster that a for loop in a formula node. You ...

Get rid of image border using saveas...
Dear All, Whenever I use saveas command to save a figure, I always get a very thick white border surrounding the image. I was wondering if there is any way to get rid of those white borders. Thanks a lot, Peichung Peichung Shih wrote: > Dear All, > > Whenever I use saveas command to save a figure, I always get a very > thick white border surrounding the image. I was wondering if there is > any way to get rid of those white borders. Adjust the size of your axis. That white border is what the grey region of the figure outside the axes becomes when the figure...

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 ...

How to download from blastwave WITHOUT using pkg-get?
How to download from blastwave WITHOUT using pkg-get? Like, download to my shell-acct (on panix.com, uses netbsd for its OS) Or, download via Win2K, onto CD, sneaker-net to blade100. (Since presumably pkg-get runs only under Solaris.) Any ideas? Nothing I read there at blastwave tells me how. Thanks, David PS: Not that I'd be able to use it (given no *direct* connection to internet) -- but I couldn't see even how to download an up-to-date pkg-get, even from that other web-site blastwave sends you to. (Could that be due to my (non-gui) shell-account lilmiting me to LYNX-bro...

Thunderbird. How Do I Get Rid Of Spam Using Keywords?
I get lots of spam from porn sites. I want to set up a filter in Thunderbird 1.5 beta so it will trash emails with certain key words. I'm sure you can imagine what they are. Is this possible? If so, how do I do it? Thanks for your help, Earl Williams, Surrey, British Columbia ...

How to get used CPU time in a SAS datastep
Hi all, 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; durationCPU = endCPU - startCPU; run; so, that i can run all tests over the weekend (or night) and get all needed information in a nice looking ...

How to refactor duplicated code without using helper classes?
What is the correct way to refactor duplicated code? Suppose you have Class A and Class B. Some code is duplicated in Class A and Class B. If there is a base class for these classes or if it is justified to extract a base class for Class A and Class B then I can move the code there. However, if Class A and Class B do not have a base class and if it is not justified to extract a base class, the simple way to resolve the problem is to move the code in a public static method of a public helper class. But I don't like helper classes and helper methods; they are too close to function libraries and too far from OO. In our project we now have at least 10 helpers classes with dozens of static methods. I would like to get rid of them but I am not sure how to do so. Thanks Syl "Sylvain" <redhotsly@hotmail.com> wrote: > What is the correct way to refactor duplicated code? Duplicated code means a common abstraction. Find the abstraction and make a class. > Suppose you have Class A and Class B. Some code is duplicated in Class A and > Class B. If there is a base class for these classes or if it is justified to > extract a base class for Class A and Class B then I can move the code there. > > However, if Class A and Class B do not have a base class and if it is not > justified to extract a base class, the simple way to resolve the problem is > to move the code in a public static method of a public helper class. But I > ...

without changing code how to get updated sas programes
Hi sir, Pls help me for this coding modification. %window tdmu irow=4 rows=22 icolumn=10 columns=60 #5 @08 "tdmu reports" attr=highlight color=blue @25 "sysday &sysdate9"color=blue #7 @08 "select to execute:" attr=highlight color=blue #9 @08 "1 td space report" #10 @08 "2 wd report" #11 @08 "3 compliance report" #12 @08 "4 compliance report for pi" #13 @08 "5 wd email program" #14 @08 "6 compliance report email program" #15 @08 "Q quit" #18 @27 getreport 1 attr=underline #22 @27 "plea...

get a mean of indexed data without using for loop
I'm trying to obtain a mean of numbers, using different indices, without using a 'for' loop. For example, say I have the following matrix x: x = [101 3; ... 101 2; ... 101 1; ... 102 8; ... 103 5; ... 103 5; ... 104 6; ... 104 8; .. 104 5.2; ... 104 7; ... 109 5; ... 109 7]; I would like to get the mean in column 2 for all instances of column 1==101, and the mean in column 2 for all instances of column 1==101, etc. Does anyone know of an efficient manner for doing this without using a 'for' loop? "Ryan " <jessupr@tcd.ie> wrote in message...

using sas to get data from remote oracle database
We have a project that is ramping up that involves connecting to an oracle database in europe. Assuming we get a connection to the database what would be our best options for getting the data. I'm hoping to avoid using sqlplus to dump the data to a flat file (an approach I've had to use in the past). Much will depend on what kind of connection we are given to the remote system. We have SAS access to oracle but not a license for oracle itself. Can the oracle odbc driver be downloaded and used to create an odbc connection or should I stick to the SAS access to oracle? ...

How to create family tree like grouping using SAS
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 identities as below, D - Daughter F - Father H - Husband M - Mother S - Son W - Wife But two persons can be related via one of the 10 relations ('F-S','S- F','M-S','S-M','F-D','D-F','M-D','D-M','H-W','W-...

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...

Web resources about - 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:58 AM