Is there an efficient way of transposing huge table in SAS

前端 未结 3 411
攒了一身酷
攒了一身酷 2021-01-23 17:42

I have a data set in SAS that I need to transpose. It has the form id date type value and I need to convert it into id date valueoftype1 valueoftype2 ...

Is there any

3条回答
  •  一整个雨季
    2021-01-23 18:19

    if first.date then a=.;b=.;c=.;d=.; 
    

    has to be replaced with:

    if first.date then do;
        a=.;b=.;c=.;d=.;
    end;
    

    or

    if first.date then call missing(a,b,c,d);
    

    Also instead of

    if last.date then do; output; a=.;b=.;c=.;d=.; end;
    

    now, it should be enough :

    if last.date then output;
    

    I guess a datastep will always be more efficient then PROC TRANSPOSE on big data. The limit is you have to find out of distinct values of the transposed variable and create new variables for those. I think that's the overhead of PROC TRANSPOSE - it first finds out the values. (I'm sorry I edited your own answer, so it might not be clear now what was the problem.)

提交回复
热议问题