LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 1998, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 13 Jul 1998 14:26:02 -0500
Reply-To:     "H. T. Cheng" <hcheng@ERAC.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         "H. T. Cheng" <hcheng@ERAC.COM>
Subject:      Re: Comparing observation variables within 1 dataset
Content-Type: text/plain; charset=ISO-8859-1

I have seen several very good answers to this thread, including SQL and Proc Transpose solutions. Here comes another thought: If the original author is interested in any kind of ranking of the current value among all the values for a given a variable in the dataset, then Proc Rank might be useful.

Regards!

Harry Cheng (hcheng@erac.com)

Enterprise Rent-A-Car (314) 512-2096 (Work) (314) 512-4096 (Fax)

---------- > From: Bernard Tremblay <bernard@CAPITALE.QC.CA> > To: SAS-L@UGA.CC.UGA.EDU > Subject: Re: Comparing observation variables within 1 dataset > Date: Monday, July 13, 1998 5:16 AM > > Hi, > > First thought about it: > > Is your dataset small enough to be transposed and then load > one variable in memory ? > > if yes, then you could : > > 1- Get the number of observations ; > 2- Get the name and type of each variable from the > dictionary (dictionary.columns); > 3- transpose the dataset; > 4- Merge dictionary info with the transposed dataset by _name_; > 5- In a datastep have 2 arrays of size NOBS. One for numeric, > one for character. Then loop thru your array to compare, > if any differences then output an appropriate message... > (The variable _name_ contains the name of the variable) > > 6- done! > > > Second thought about it: > > May be one could loop with a macro that would create a new > dataset similar to the original but the order of observations changed. > then run a proc compare to compare both files and so on until all > combination are done ??? > > Happy coding! > > regards, > Bernard Tremblay > \\\|/// > \\ - - // > ( @ @ ) > +------oOOo-(_)-oOOo----------+---------------------------------+ > | Bernard Tremblay | | > | La Capitale | Tel: (418) 646-2401 | > | | Fax: (418) 646-5960 | > | | Int: bernard@capitale.qc.ca | > +-----------------------------+---------------------------------+ > | Imaginasys enr | Res: (418) 878-4447 | > | | Int: bertrem@quebectel.com | > +---------------Oooo----------+---------------------------------+ > oooO ( ) > ( ) ) / > \ ( (_/ > \_) > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ > >>>Date: Sat, 11 Jul 1998 06:55:26 GMT > >>>Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU> > >>>From: Andreas Grueninger <grueni@STUTTGART.NETSURF.DE> > >>>Subject: Re: Comparing observation variables within 1 dataset > >>> > >>>DATA test; > >>> DO i=1 TO 5; a=i; OUTPUT; END; > >>>RUN; > >>> > >>>DATA _null_; > >>> SET test NOBS=nobs; > >>>PUT 'Comparing value of record ' _n_ ; > >>> DO i=_n_+1 TO nobs; > >>> SET test (RENAME=(a=next)) POINT=i; > >>>PUT +3 'with value of record ' i a= next=; > >>> END; > >>>RUN; > >>> > >>>On Thu, 09 Jul 1998 16:38:19 -0400, vermurra@email.uc.edu wrote: > >>> > >>>>Can anyone help me or point me in the right direction? > >>>> > >>>>I'm trying to locate discrepancies in a dataset by comparing variables > >>>>in one observation to the same variables in every other observation. > >>>> > >>>>In short, I want to compare var1 in obs1 to var1 in obs2, obs3, etc. > >>>>Then I want to do the same for obs2, comparing it to obs3, obs4 etc. > >>> > >>>--------------------------- > >>>Andreas Grueninger > >>> > >>>PRIVAT: grueni@stuttgart.netsurf.de > >>>OFFICIAL: grueninger@lfl.bwl.de > >>>--------------------------- > >>>


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