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 2009, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 24 Feb 2009 11:45:30 -0800
Reply-To:   sasgeek009@GMAIL.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   sasgeek009@GMAIL.COM
Organization:   http://groups.google.com
Subject:   Re: String operations with Tranwrd
Comments:   To: sas-l@uga.edu
Content-Type:   text/plain; charset=ISO-8859-1

On Feb 24, 12:30 pm, anindya.lugb...@GMAIL.COM (Anindya Mozumdar) wrote: > The tranwrd function is being applied to each data line multiple > times, so for example the 1st record is converted to ALABAMA then the > LA in ALABAMA getting converted to LOUISANA and so on. If you really > want to do it this way, use an IF statement. > > Regards, > Anindya > > > > On Tue, Feb 24, 2009 at 11:53 PM, <sasgeek...@gmail.com> wrote: > > I am trying to use Transwrd function to convert state code to full > > state name and it is not working fine. For example : AL - Alabama, MS > > - Mississippi, etc.. > > > Here is the code.. > > > data mail; > > infile datalines dlm=' ,'; > > input state $20.; > > State = tranwrd(State,'AL','ALABAMA.'); > > State = tranwrd(State,'AK','ALASKA.'); > > State = tranwrd(State,'AZ','ARIZONA.'); > > State = tranwrd(State,'AR','ARKANSAS.'); > > State = tranwrd(State,'CO','COLORADO.'); > > State = tranwrd(State,'CT','CONNECTICUT.'); > > State = tranwrd(State,'DE','DELAWARE.'); > > State = tranwrd(State,'FL','FLORIDA.'); > > State = tranwrd(State,'GA','GEORGIA.'); > > State = tranwrd(State,'HI','HAWAII.'); > > State = tranwrd(State,'ID','IDAHO.'); > > State = tranwrd(State,'IL','ILLINOIS.'); > > State = tranwrd(State,'IN','INDIANA.'); > > State = tranwrd(State,'IA','IOWA.'); > > State = tranwrd(State,'KS','KANSAS.'); > > State = tranwrd(State,'KY','KENTUCKY.'); > > State = tranwrd(State,'LA','LOUISIANA.'); > > State = tranwrd(State,'ME','MAINE.'); > > State = tranwrd(State,'MD','MARYLAND.'); > > State = tranwrd(State,'MA','MASSACHUSETTS.'); > > State = tranwrd(State,'MI','MICHIGAN.'); > > State = tranwrd(State,'MN','MINNESOTA.'); > > State = tranwrd(State,'MS','MISSISSIPPI.'); > > State = tranwrd(State,'MO','MISSOURI.'); > > State = tranwrd(State,'MT','MONTANA.'); > > State = tranwrd(State,'NE','NEBRASKA.'); > > State = tranwrd(State,'NV','NEVADA.'); > > State = tranwrd(State,'NH','NEW HAMPSHIRE.'); > > State = tranwrd(State,'NJ','NEW JERSEY.'); > > State = tranwrd(State,'NM','NEW MEXICO.'); > > State = tranwrd(State,'NY','NEW YORK.'); > > State = tranwrd(State,'NC','NORTH CAROLINA.'); > > State = tranwrd(State,'OH','OHIO.'); > > State = tranwrd(State,'OK','OKLAHOMA.'); > > State = tranwrd(State,'OR','OREGON.'); > > State = tranwrd(State,'PA','PENNSYLVANIA.'); > > State = tranwrd(State,'RI','RHODE ISLAND.'); > > State = tranwrd(State,'SC','SOUTH CAROLINA.'); > > State = tranwrd(State,'SD','SOUTH DAKOTA.'); > > State = tranwrd(State,'TN','TENNESSEE.'); > > State = tranwrd(State,'TX','TEXAS.'); > > State = tranwrd(State,'UT','UTAH.'); > > State = tranwrd(State,'VT','VERMONT.'); > > State = tranwrd(State,'VA','VIRGINIA.'); > > State = tranwrd(State,'WA','WASHINGTON.'); > > State = tranwrd(State,'WV','WEST VIRGINIA.'); > > State = tranwrd(State,'WI','WISCONSIN.'); > > State = tranwrd(State,'WY','WYOMING.'); > > > datalines; > > AL, > > AK, > > AZ, > > AR, > > CA, > > CO, > > CT, > > DE, > > FL, > > GA, > > HI, > > ID, > > IL, > > IN, > > IA, > > KS, > > ME, > > MD, > > MA, > > MI, > > MN, > > MS, > > MO, > > MT, > > NE, > > NV, > > NH, > > NJ, > > NM, > > NY, > > NC, > > ND, > > OH, > > OK, > > OR, > > PA, > > RI, > > SC, > > SD, > > TN, > > TX, > > UT, > > VT, > > VA, > > WA, > > WV, > > WI, > > WY, > > ; > > run; > > > Can someone help me with this...- Hide quoted text - > > - Show quoted text -

Hey Anindya,

Thanks for your help!!


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