Transpose with Array

by Irina 14. April 2007 07:58

data product_transpose;
set product_transpose_200110_200201;
array product

ms_cards
salary
l_miuazim
miuazim
num_hk
sum_hk 
loan
misgeret_ashrai
osher
pasiv;

array name{10} $ 16;
do i=1 to dim(product);
name[i]=vname(product[i]);
amount=product [i];
varname=name[i];
month_lag=month_lag6;
output;
end;
keep amount varname month_lag;
run;


proc sql;
select distinct
year into: period
separated by '+'
from example;
quit;

 

%macro trans;
%do i=1 %to 2;
DATA example (DROP=I year x y year1 year2 z);
;
ARRAY years {2} year1- year2;
ARRAY xs {2} x1-x2;
ARRAY ys {2} y1-y2;
DO I=1 TO 2 UNTIL (LAST.b);
SET dug;
BY b;
years {I}=year;
x_%scan(&period,&i,+)=xs{I};

xs{I}=x;
ys{I}=y;
END;

run;
%end;
%mend;
%trans;

 

Related posts

Add comment


(will show your Gravatar icon)  





Live preview

7/30/2010 8:25:52 AM

 

About the author

Irina Spivak Irina Spivak
Team Leader at G-Stat. More...


Send mail Email

Authors

Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in

    eXTReMe Tracker