From: Amar Mundankar on 17 Apr 2010 07:25 Hi all, %let list = VAR1 VAR2 VAR3; Input dataset has 5 variables. lile A B VAR1 COL2 VARIABLE3. Now i want to rename the variables VAR1 VAR2 and VAR3 to VAR1_PREV VAR2_PREV and VAR3_PREV in data statement. I want to create a macro which will produce output as VAR1 = VAR1_PREV COL2 = COL2_PREV VARIABLE3 = VARIABLE3_PREV. E.G. data Test (rename = (%rename(&list))); /*other sas statement*/ run; I have to create a macro called rename which will take a space separated list as input and output the variable list with new values. Thanks and Regards, Amar Mundankar.
From: Barry Schwarz on 17 Apr 2010 14:16 Use the same technique I showed in response to your compare 2 files message. On Sat, 17 Apr 2010 04:25:36 -0700 (PDT), Amar Mundankar <amarmundankar(a)gmail.com> wrote: >Hi all, > >%let list = VAR1 VAR2 VAR3; > >Input dataset has 5 variables. lile A B VAR1 COL2 VARIABLE3. >Now i want to rename the variables VAR1 VAR2 and VAR3 to VAR1_PREV >VAR2_PREV and VAR3_PREV in data statement. > >I want to create a macro which will produce output as VAR1 = VAR1_PREV >COL2 = COL2_PREV VARIABLE3 = VARIABLE3_PREV. > >E.G. >data Test (rename = (%rename(&list))); > /*other sas statement*/ >run; > >I have to create a macro called rename which will take a space >separated list as input and output the variable list with new values. > >Thanks and Regards, >Amar Mundankar. -- Remove del for email
|
Pages: 1 Prev: Query regarding SAS Macros & ODS Next: forcing decimal places |