Prev: How to create a SAS instalator program for SAS application?
Next: SAS Professionals Convention 2010
From: Jeli on 30 Apr 2010 10:53 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 30 Apr 2010 11:15 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 5 May 2010 04:00 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
|
Pages: 1 Prev: How to create a SAS instalator program for SAS application? Next: SAS Professionals Convention 2010 |