Date: Wed, 2 May 2007 09:25:50 -0500
Reply-To: "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Huang, JS" <Huang.JS@PRINCIPAL.COM>
Subject: Re: Help with concatenation problem
In-Reply-To: A<200705021409.l42CV7kT025631@mailgw.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Here is one implementation:
333 options nomprint nosymbolgen;
334 %macro Test(tot_obs);
335 %do i = 1 %to &tot_obs;
336 %let grp&i=;
337 %do j = 1 %to &tot_obs;
338 %let var&i&j=var&i&j;
339 %put var&i&j=&&var&i&j;
340 %let grp&i=&&grp&i&&var&i&j;
341 %end;
342 %put grp&i=&&grp&i;
343 %end;
344 %mend;
345 %Test(3)
var11=var11
var12=var12
var13=var13
grp1=var11var12var13
var21=var21
var22=var22
var23=var23
grp2=var21var22var23
var31=var31
var32=var32
var33=var33
grp3=var31var32var33
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Sekxanh Chanthaboury
Sent: Wednesday, May 02, 2007 9:09 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help with concatenation problem
I have 9 variables created dynamically by the following code:
var11
var12
var13
var21
var22
var23
var31
var32
var33
%do i = 1 %to &tot_obs;
%do j = 1 %to &tot_obs;
var&i&j = " ";
%end;
%end;
I would like to create three new concatenated variables:
grp1 = var11 || var12 || var13;
grp2 = var21 || var22 || var23;
grp3 = var31 || var32 || var33;
Of course this all has to be done dynamically. Anyone have any ideas???
Thank you.
Regards,
Sekxa
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.