Date: Wed, 4 Feb 2009 16:53:04 +0000
Reply-To: karma <dorjetarap@GOOGLEMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: karma <dorjetarap@GOOGLEMAIL.COM>
Subject: Re: A Variable value combination Question - VERY VERY URGENT
In-Reply-To: <200902041616.n14BkWvt015498@malibu.cc.uga.edu>
Content-Type: text/plain; charset=ISO-8859-1
HTH
data have;
input subject Group $;
cards;
10021 Perga
12124 double
12545 Perga
47845 Single
;run;
data want(drop=group rename=(groups=group));
retain groups ;
length groups $30;
do until (eof1);
set have(keep=group) end=eof1;
if ^index(groups, strip(group)) then groups = catx('/',groups, group);
end;
do until(eof2);
set have end=eof2;
output;
end;
run;
2009/2/4 Tom Smith <need_sas_help@yahoo.com>:
> I have the following dataset with two variables (subject, Group):
>
> subject Group
> ------
> 10021 Perga
> 12124 double
> 12545 Perga
> 47845 Single
>
>
> I need to combine the variable Group so it shows all possible
> values for each subject the final dataset result should be
> as below:
>
>
> subject Group
> ------
> 10021 Perga/double/single
> 12124 Perga/double/single
> 12545 Perga/double/single
> 47845 Perga/double/single
>
> Thank you
>
|