Link to home
Start Free TrialLog in
Avatar of morinia
moriniaFlag for United States of America

asked on

Counting the number of columns in a SAS dataset after a proc transpose.

Experts,

I have just run this step in SAS.

Proc transpose data=diags out=dx;
          by claim_id;
          var diag;
run:

My question is once the file is created I can look at it and see how many diag columns were generated.  I was just wondering if there was code to give me the results or to combine the next these two steps without manual intervention.  The number of columns will vary relative to the data.

My next step is: (assuming 10 columns were generated)
Data dx_rename;
     Set dx rename=col1-col10=dx10-dx10 drop=_name_ _label_);
run;
SOLUTION
Avatar of Ian
Ian
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of morinia

ASKER

This is exactly what I needed.  Since there was no need for the rename after using this code.

Proc transpose data=diags
                 out=dx(drop=_name_ _label_)
                 prefix=DX;
          by claim_id;
          var diag;
run: