I want to run a macro to perform the transpose for many datasets. However, the number of variables that need to be transposed is slightly different across datasets. It could be 39, 40 or 41. Suppose I define those variables as VAR1, VAR2, etc.
My macro for transpose is like:
%do i=1999 %to 2018;
proc transpose data=have_&i out=want_&i;
var var1-var40; /*the number of vars is different across each dataset (in each year)*/
I created a dataset below to have the number of variables I need to transpose in each year:
Oh, thank you. It's so simple. I was using PROC SQL and a lot of other stuff. I just make thing complicated.
SAS INNOVATE 2024
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.