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 (February 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 29 Feb 2008 11:12:03 +0100
Reply-To:     Stefan Pohl <stefan.pohl@ISH.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Stefan Pohl <stefan.pohl@ISH.DE>
Subject:      AW: read out a string
Comments: cc: Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
In-Reply-To:  <200802290902.m1T929Rr026458@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Dear sas-group,

in the variable IDs is written how my cluster algorithm merges id 1,...,9.

IDs [1 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9] [1 4] [5 5] [6 6] [7 7] [8 8] [9 9] [1 4] [5 5] [6 8] [9 9] [1 9]

The notation [1 2] means id=1 and id=2 are in one cluster. I want to claculate for each clustering scheme, for example [1 4] [5 5] [6 8] [9 9], the sum of within cluster variances. So at first, I have to read out each clustering scheme.

This are my data. For each id there is an Index and a weight.

DATA have; INPUT id weight Index; CARDS; 1 172810.00 77.70000 2 464331.00 78.02000 3 109316.00 79.32000 4 379591.00 79.75000 5 227676.00 79.95000 6 138160.00 80.04000 7 524807.00 80.57000 8 358220.00 80.91000 9 82134.00 81.12000 ;; RUN;

First cluster scheme: The cluster scheme [1 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9] means each id defines one cluster, so the weighted sum of within cluster variances is 0.

Last cluster scheme: The cluster scheme [1 9] means all ids are in the same cluster and the weighted sum of within cluster variances can be calculated with PROC UNIVARIATE.

PROC UNIVARIATE DATA=have NOPRINT; VAR Index; FREQ weight; OUTPUT OUT = weightvar VAR= weightvar; RUN;

Between the first and the last cluster scheme I have to know how the algorithm merges the ids to calculate the weighted sum of within cluster variances. So I have to read out the information in IDs.

I am not sure how to do this very efficient within a macro.

I hope my problem is understandable.

Best regards, Stefan.

> >Dear sas-group, > > > >I want to read out the information in a string IDs who looks > like this > > > >IDs > >obs1: [1 2] [3 3] [4 4] [5 5] [6 6] [7 7] [8 8] [9 9] > >obs2: [1 4] [5 5] [6 6] [7 7] [8 8] [9 9] > >obs3: [1 4] [5 5] [6 8] [9 9] > >obs4: [1 9] > > > >One first idea for a macro readout: > > > >%MACRO readout(data); > > > >*obs1; > > > >%DO i=1 TO 8; > > > > DATA readout1; > > SET &data; > > WHERE ID in (1,2); *here the string IDs has to be read out; RUN; > > > > .... > > > >%END; > > > >%MEND readout; > > > >How can I read out the information in the [...]? > > > >Best regards, Stefan. > > > Hi Stefan, > first I can say, that a macro in that environment might not a > good idea, > second: mixing macro- and datastep code is a very bad idea! > > %do i=1 to 8; > > will never do what you want, whatever it is. > > One question: what are that "IDs"? What do you want to get? > Maybe it would be easier to understand, if you provide the > desired result, instead of the method you try to get it. > > Gerhard > > __________ NOD32 2910 (20080228) Information __________ > > This message was checked by NOD32 antivirus system. > http://www.eset.com > >


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