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 (September 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 23 Sep 2004 04:05:32 -0700
Reply-To:     W Dennis Diskin <diskin@ALUM.RPI.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         W Dennis Diskin <diskin@ALUM.RPI.EDU>
Subject:      Re: Summing lines of a SAS dataset??
Comments: To: Howard_Schreier@ITA.DOC.GOV
Content-Type: text/plain; charset="iso-8859-1"

Isn't Albany in Georgia? Oh wait, it might be California, Oregon, Indiana, Illinois, Kentucky, Louisianna, Minnesota or Missouri. Or was it a country?

<-----Original Message----->

From: Howard Schreier Sent: 9/22/2004 11:13:55 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Summing lines of a SAS dataset??

Clever advice (as usual) from Peter, but a little attention to detail is still needed. Does the SAS map dataset have all of the cities referenced in Julie's data? Are there perhaps spelling differences (Pittsburg vs. Pittsburgh) which will foul up the lookup?

On Wed, 22 Sep 2004 18:04:23 -0400, Peter Crawford wrote:

>some of these ideas are OK some good, but all seem to miss the >trick > >among the maps data library I have table citystate(came with SAS) >providing both ...... just what you need! > >The other, associated, idea is the cntlin= dataset option for proc format > >Put them together to simplify and solve...... >along with the idea that proc summary provides by default(iirc) >totals by formatted value of class vars > >Good Luck >Peter Crawford > >On Wed, 22 Sep 2004 14:42:06 -0700, Pardee, Roy wrote: > >>And to get you started on that format, try this: >> >>Proc sql ; >> select disinct "'" || trim(city_state) || "' = ''" >> from my_table ; >>Quit ; >> >>That should spit out text like so in your .lst file: >> >> 'Maryland' = '' >> 'Virginia' = '' >> 'New York' = '' >> <> >> >>Which you can then copy/paste into your program, after adding the call >>to PROC FORMAT etc., and fill in w/the proper values. >> >>HTH, >> >>-Roy >> >>-----Original Message----- >>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of >>Fehd, Ronald J. >>Sent: Wednesday, September 22, 2004 1:50 PM >>To: SAS-L@LISTSERV.UGA.EDU >>Subject: Re: Summing lines of a SAS dataset?? >> >> >>> From: Julie >>> suppose I have a SAS dataset for a bunch of states and states, such >>> as... >>> >>> A B C >>> Maryland 33 50 54 >>> Virginia 35 64 79 >>> New York 65 74 33 >>> Ohio 31 82 29 >>> Baltimore 22 13 34 >>> Albany 11 20 22 >>> Cleveland 22 21 34 >>> Arlington 60 40 72 >>> >>> Is there a simple code you can write to ask the SAS program to add >>> all Albany numerical data (in each column) to New York's data (i.e. so >> >>> the final data set would read New York 76 94 67 on one line) >>> Cleveland's numerical data to Ohio's numerical data (i.e. so the final >> >>> data set would read Ohio 53 103 63 on one line) and so on and have >>> these summed up numbers by state in one final dataset?? I hope someone >>> understands what I'm trying to do... thanks!!! >> >>as Toby said, with some hefty coding >> >>you'll need to add State >>then you can sum by state >>with proc Means, etc. >> >>I would suggest a format: >>PROC Format $City2State >>'Baltimore' = 'MD' >>'Cleveland' = 'OH' >>...; >>Data City2State; >>attrib State length = $ 2; >>set Miscellaneous; >>State = put(CityOrState,$City2State.); >> >>PROC Means/Summary; >> etc. >> >>Ron Fehd the macro maven CDC Atl GA USA .


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