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 2000, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 28 Sep 2000 12:06:12 GMT
Reply-To:     charles_s_patridge@MY-DEJA.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         charles_s_patridge@MY-DEJA.COM
Organization: - Before you buy.
Subject:      Re: How to reverse variables


I tried this code but I do not see the desired results. What am I missing? Thanks. I just wanted to add Paul's solution to the others you received so I could post them to my web site for future use.

data vset; v1=1;v2=2;v3=3;v4=4;v5=5; run;

%let n = 5;

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

Regards, Charles Patridge Email:

In article <>, wrote: > 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 >

-- Charles Patridge - PDPC, Ltd. 172 Monce Road - Burlington, CT 06013 USA Phone: 860-673-9278 or 860-675-9026 Email: - Web:

Sent via Before you buy.

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