LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (May 1996, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 1 May 1996 11:10:00 -0400
Reply-To:   fu.m@PG.COM
Sender:   "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:   Min Fu <fu.m@PG.COM>
Subject:   Re: Stratification Index

Message authorized by: : /S=Abdelmoneim.H.Elnagheeb@AEXP.COM/OU=SMTP/O=1.UCN.GO.1/P=PROCTERGAMBLE/A The following codes would do what you want but still wouldn't avoid an internal sorting. The INDICAT table would be sorted by I.

data ONE; input Y Z X; cards; 3 4 5 ... ; run;

proc sql; create table INDICAT as select A.*, B.I from ONE as A left join (select distinct X, count(X) as I from ONE group by X) as B on A.X=B.X ; quit;

Min Fu fu.m@pg.com

______________________________ Reply Separator _________________________________ Subject: Stratification Index Author: (INTERNET)SAS-L@UGA.CC.UGA.EDU at external Date: 4/30/96 4:29 PM

Hi SAS-Lers: I have sent the message below few days back and hope to get responses this time. Thanks for any help. ====================================message======================== Hello SAS-Lers: I have a large data set with a variable, say X, which may have the same value for different OBSERVATIONS. I want to create an indicator that will have the number of times that X has the same value across observations. Here is a crude example:

Y Z X I ---------------------------------------------------------------- 3 4 5 3 2 7 3 Now I want to create Indicator, I: 2 3 9 5 3 9 6 1 1 6 1 3 2 5 4 5 3

Here 5 is repeated 3 times, 3 repeated 2 times, and 1 once.

Note: the data is big (with many observations) and if there is a way to avoid sorting that will be great. Any help will be appreciated. Thanks in advance.

Abdu


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