From: Jeli on
I have a large dataset and I want to concatenate some variables eg

data test;
infile cards missover;
input Variable1 wgt1 Variable2 wgt2 variable3 wgt3;
cards;
GBR 50 AUS 50 . .
AUS 20 NZD 20 USA 60
GBR 100
USA 20 ESP 40 CAN 40
;
run;

I want to create a new variable, seperated by a comma but not
including the missing parts

ie

NewVar
GBR,50,AUS,50
AUS,20,NZD,20,USA,60
GBR,100
USA,20,ESP,40,CAN,40

can anyone help





however some of the
From: data _null_; on
On Apr 30, 9:53 am, Jeli <jeli0...(a)hotmail.co.uk> wrote:
> I have a large dataset and I want to concatenate some variables eg
>
> data test;
> infile cards missover;
> input Variable1 wgt1 Variable2 wgt2 variable3 wgt3;
> cards;
> GBR 50 AUS 50 . .
> AUS 20 NZD 20 USA 60
> GBR 100
> USA 20 ESP 40 CAN 40
> ;
> run;
>
> I want to create a new variable, seperated by a comma but not
> including the missing parts
>
> ie
>
> NewVar
> GBR,50,AUS,50
> AUS,20,NZD,20,USA,60
> GBR,100
> USA,20,ESP,40,CAN,40
>
> can anyone help
>
> however some of the

CATX, you also want the missing=' ' option to achive the desired
result.;

options missing=' ';
data test;
infile cards missover;
input Variable1 $ wgt1 Variable2 $ wgt2 variable3 $ wgt3;
length all $50;
all = catx(',',of variable1--wgt3);
cards;
GBR 50 . . AUS 50
AUS 20 NZD 20 USA 60
GBR 100
USA 20 ESP 40 CAN 40
;;;;
run;
proc print;
run;
From: Jeli on
On 30 Apr, 16:15, "data _null_;" <datan...(a)gmail.com> wrote:
> On Apr 30, 9:53 am, Jeli <jeli0...(a)hotmail.co.uk> wrote:
>
>
>
>
>
> > I have a large dataset and I want to concatenate some variables eg
>
> > data test;
> > infile cards missover;
> > input Variable1 wgt1 Variable2 wgt2 variable3 wgt3;
> > cards;
> > GBR 50 AUS 50 . .
> > AUS 20 NZD 20 USA 60
> > GBR 100
> > USA 20 ESP 40 CAN 40
> > ;
> > run;
>
> > I want to create a new variable, seperated by a comma but not
> > including the missing parts
>
> > ie
>
> > NewVar
> > GBR,50,AUS,50
> > AUS,20,NZD,20,USA,60
> > GBR,100
> > USA,20,ESP,40,CAN,40
>
> > can anyone help
>
> > however some of the
>
> CATX, you also want the missing=' ' option to achive the desired
> result.;
>
> options missing=' ';
> data test;
>    infile cards missover;
>    input Variable1 $ wgt1 Variable2 $ wgt2 variable3 $ wgt3;
>    length all $50;
>    all = catx(',',of variable1--wgt3);
> cards;
> GBR 50 . . AUS 50
> AUS 20 NZD 20 USA 60
> GBR 100
> USA 20 ESP 40 CAN 40
> ;;;;
>    run;
> proc print;
>    run;- Hide quoted text -
>
> - Show quoted text -

I have SAS BASE8.2 so Catx doesnt work