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 (September 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 27 Sep 2000 16:25:34 -0700
Reply-To:   maxzwingli@mail.nu
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Max Zwingli <maxzwingli@MAIL.NU>
Subject:   How to reverse variables
Content-Type:   text/plain

Thanks to Wei Yen, Paul Dorfman, Harry Doogendyk, Richard Graham, Peter Crawford for their instant help. As a summary, I asked how to reverse a 1-byte character array with &N elements without using an additional intermediate array to hold the elements in the reverse order. The one-array solution adopted is to swap opposite elements and move towards center as offered by Paul Dorfman. Actually Paul went further and offered a zero-array (!) solution I would never even suspect could exist

data reverse; set vset; call poke(reverse(peekc(addr(v1),&n)),addr(v1),&n); run;

Up until I saw this rather unusual code, I never thought that poke, peek and addr could be of any practical use whatsoever.

Thanks Max

_____________________________________________________________ Get Your Own .NU Web Address Now! ---> http://WWW.NUNAMES.NU


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