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 (January 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 10 Jan 2000 14:54:47 +0100
Reply-To:   detecsm_hellriegelg@WESTLB.DE
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gehard Hellriegel <detecsm_hellriegelg@WESTLB.DE>
Subject:   Re: Program challenge? changing variable names based on lookup dataset
Content-type:   text/plain; charset=us-ascii

Hi Larry, that should be no big problem. Something like:

data _null_; set data2; call symput("n"!!compress(put(_n_,7.)),acnumnew); call symput("o"!!compress(put(_n_,7.)),acnum); call symput ("no",_n_); run;

%macro a; proc datasets lib=work; modify data3; %do i=1 %to &no; rename a&&o&i=a&&n&i; rename b&&o&i=b&&n&i; %end; run; quit; %mend; %a;

should do it....

Larry Van Horn <vanhorn@SIMON.ROCHESTER.EDU> on 06.01.2000 20:13:08

Bitte antworten an Larry Van Horn <vanhorn@SIMON.ROCHESTER.EDU>

An: SAS-L@LISTSERV.UGA.EDU Kopie: (Blindkopie: DeTeCSM HellriegelG/D/ExternalStaff/WLB) Thema: Program challenge? changing variable names based on lookup dataset

Folks, I have a problem I have not been able to work around. I have two data sets DATA1 Variable ID a1 a2 a3 b1 b2 b3 obs1 X 1 5 8 7 9 4

DATA2 Variable acnumnew acnum obs 1 1 6010 2 2 6020 3 3 6050

I would like DATA3 change the variable names based on the values in DATA2

DATA3 Variable ID a6010 a6020 a6050 b6010 b6020 b6050 obs1 X 1 5 8 7 9 4

When the value of acnumnew=1 change the variable name in a1 and b1 to reflect the value of acnum. I didn't think that this would be difficult, but haven't been successful. Any suggestions? TIA

Larry

Mit freundlichen Gruessen

DeTeCSM, Gerhard Hellriegel

WestLB Abteilung: 001-80622 Aderstr. 22 D - 40217 Duesseldorf Tel.: +49211 826 6173 Fax: +49211 826 5393


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