Date: Thu, 28 Sep 2000 14:15:32 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: Deja.com - Before you buy.
Subject: Re: How to reverse variables
Jonathan, Max and Paul -
I tried the following and it still does not work as proposed by what was
posted on SAS-l.
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;
The output is:
OBS V1 V2 V3 V4 V5
1 2 1 3 4 5
on OpenVMS SAS version 6.12 running TS065
I suspect there is a problem but not sure where to look.
I really do not have time to research this as it is only a tip and not a
real problem for me to find an answer to.
Thanks.
Charles Patridge
In article <86256968.004A5C5D.00@mastercard.com>,
Jonathan_Goldberg@MASTERCARD.COM wrote:
> charles_s_patridge@MY-DEJA.COM asks:
>
> >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;
>
> peekc is for character data, as in the original problem. If the first
data set
> is changed to:
>
> data vset;
> v1='1';v2='2';v3='3';v4='4';v5='5';
> run;
>
> the code works as intended.
>
> Jonathan
>
--
Charles Patridge - PDPC, Ltd.
172 Monce Road - Burlington, CT 06013 USA
Phone: 860-673-9278 or 860-675-9026
Email: Charles_S_Patridge@prodigy.net - Web: www.sasconsig.com
Sent via Deja.com http://www.deja.com/
Before you buy.