SAS: column position rearrangement -


i rearange variable column poistion depending on ft value: example. if ft =1, put o2 , o5 @33 , 34. if ft=2, put o2 , o5 @35 , 36 , on... think got loop , array incorrect below. can point out did wrong?

data fttry1;  input ft m1 o2 m3 m4 o5;  datalines;  1 2 3 4 5 6   2 7 8 9 10 11  3 12 13 14 15 20  4 16 17 18 19 21  ; run;  data fttry2;  set fttry1;  file print notitles;  put   @10 ft        @30 m1        @31 m3-m4;  ft =1 4;   array ftposition[2] o2 o5;   i=1 2;    l=33 34 2;     put @l ftposition[i];    end;   end;  end; run; 

does work?

data fttry1;  input ft m1 o2 m3 m4 o5;  datalines;  1 2 3 4 5 6   2 7 8 9 10 11  3 12 13 14 15 20  4 16 17 18 19 21  ; run;  data fttry2;  set fttry1;  file print notitles;  cnt + 1;  put   @10 ft        @30 m1        @31 m3-m4 @;   o2_loc=(ft+cnt) + 32;   o5_loc=(ft+cnt) + 33;  put @o2_loc o2 @;  put @o5_loc o5 ; run; 

edit this link indicates trailing @ sign prevent newline after put statement.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -