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 2011, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Feb 2011 21:45:13 -0500
Reply-To:     bbser 2009 <bbser2009@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         bbser 2009 <bbser2009@GMAIL.COM>
Subject:      Re: Tricky data management
Comments: To: "Keintz, H. Mark" <mkeintz@WHARTON.UPENN.EDU>
In-Reply-To:  <E0B423A8C0D1E74B8905B2C5CB38C1AF1353C7@GENO3.wharton.upenn.edu>
Content-Type: text/plain; charset="us-ascii"

Mark

Bingo! Just out of curiosity, is there any particular thought about setting up a view instead of just a data set?

Thanks. -Max

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Keintz, H. Mark Sent: February-15-11 9:18 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: [SAS-L] Tricky data management

Susie:

For purposes of the programing task put aside which direction is positive and which is negative. It just matters that a-->b is the opposite flow of b-->a, and that you never have a flow a-->a.

Now if a flow from a category in a lower sort order to one in a higher sort order is a positive flow, and the opposite is negative, then this should do:

data need /view=need; set have; if cat1<cat2 then do; from=cat1; to=cat2; end; else if cat2<cat1 then do; from=cat2; to=cat1; flow=-1*flow; end; run;

proc means data=need n sum; class from to; var flow; run;

Regards, Mark

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Chung Y. Li > Sent: Tuesday, February 15, 2011 8:51 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Tricky data management > > He is my boss. What he really wants to know is the NET amount of the > pairs, whichever primary category_from/category_to I choose to > represent the net. > > Susie > > On Tue, Feb 15, 2011 at 8:44 PM, bbser 2009 <bbser2009@gmail.com> > wrote: > > Susie > > > > If I were you, I would ask the guy who assigned this problem/task to > me why > > preferring informationt-energy over energy-informationt. > > If he/she refuse to answer :) , then it is at my disposal > > and I would guess the criterion might hide in the values of amount, > where > > you can see the less absolute value should be negated. > > > > -Max > > > > -----Original Message----- > > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Chung > > Y. Li > > Sent: February-15-11 8:07 PM > > To: SAS-L@LISTSERV.UGA.EDU > > Subject: Re: [SAS-L] Tricky data management > > > > I wonder if I have to do an internal data lookup, comparing the 1st > > record with the 2nd, 3rd, 4th record; compare the 2nd record with the > > 3rd, 4th record; compare the 3rd record with the 4th, 5th, 6th > record, > > on and on. When I find the from/to reversal, then I put out the > > pairs. > > > > Susie > > > > > > On Tue, Feb 15, 2011 at 7:57 PM, Joe Matise <snoopy369@gmail.com> > wrote: > >> You need to explain how to logically state which records are to be > >> reversed. If you can't do that, I don't think this problem can be > > solved... > >> > >> Is it just a matter of what's the first record you find in the data, > that > >> defines which should be 'from'? Or do you have a dataset that lists > which > >> should be 'from' and which should be 'to'? > >> > >> -Joe > >> > >> On Tue, Feb 15, 2011 at 6:48 PM, Chung Y. Li > <li.chungying@gmail.com> > > wrote: > >>> > >>> That's the problem - I have a big dataset, and don't know how many > >>> pairs are just from/to reversal categories. > >>> > >>> I am quite stumped. > >>> > >>> Susie > >>> > >>> On Tue, Feb 15, 2011 at 7:37 PM, Sterling Paramore > <gnilrets@gmail.com> > >>> wrote: > >>> > How do you define which one is on the left? > >>> > > >>> > How many categories do you have? > >>> > > >>> > > >>> > > >>> > On Tue, Feb 15, 2011 at 4:33 PM, Chung Y. Li > <li.chungying@gmail.com> > >>> > wrote: > >>> > > >>> >> (Before) > >>> >> Category_from Category_to Amount > >>> >> > >>> >> InformationT Energy $50 > >>> >> Energy InformationT $30 > >>> >> Financials Materials $25 > >>> >> Materials Financials $10 > >>> >> ... ... ... > >>> >> (After) > >>> >> Category_from Category_to Amount > >>> >> > >>> >> InformationT Energy $50 > >>> >> InformationT Energy -$30 > >>> >> Financials Materials $25 > >>> >> Financials Materials -$10 > >>> >> ... ... ... > >>> >> > >>> >> Thanks. > >>> >> Susie > >>> >> > >>> >> > On Tue, Feb 15, 2011 at 7:19 PM, Reeza K > <fkhurshed@hotmail.com> > >>> >> > wrote: > >>> >> >> Could you do something along the lines of : > >>> >> >> > >>> >> >> data want; > >>> >> >> set have; > >>> >> >> If category_from < category to then amount=-1*amount; > >>> >> >> temp=category_to; > >>> >> >> category_to=category_from; > >>> >> >> category_from=temp; > >>> >> >> run; > >>> >> >> > >>> >> >> > >>> >> >> > >>> >> >>> Date: Tue, 15 Feb 2011 18:52:43 -0500 > >>> >> >>> From: li.chungying@GMAIL.COM > >>> >> >>> Subject: Tricky data management > >>> >> >>> To: SAS-L@LISTSERV.UGA.EDU > >>> >> >>> > >>> >> >>> Hello all, > >>> >> >>> > >>> >> >>> I have a dataset with values like this: > >>> >> >>> > >>> >> >>> Category_from Category_to Amount > >>> >> >>> A B $50 > >>> >> >>> B A $30 > >>> >> >>> ... ... ... > >>> >> >>> > >>> >> >>> I need to figure out a way to make the values this way: > >>> >> >>> > >>> >> >>> Category_from Category_to Amount > >>> >> >>> A B $50 > >>> >> >>> A B -$30 > >>> >> >>> ... ... ... > >>> >> >>> > >>> >> >>> Please help. > >>> >> >>> > >>> >> >>> Susie C Y Li > >>> >> >>> li.chungying@gmail.com > >>> >> >> > >>> >> > > >>> >> > >>> > > >> > >> > >


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