Hi SAS Communities, I have quite a large dataset currently in long form with 71 variables and each observation contains an ID, a visit date, and then the remaining 69 variables such as age, sex, z-scores, etc. I would like to create one row for each ID, so that I'm able to run proc freq for the other variables once the IDs are grouped together. The output I hope to get would be a column for ID, a column for each visit_date (visit 1 to visit 28), and a column for each remaining variable. I attempted this on my own and I'm able to see each visit date in the same row as the ID it belongs to, but I am missing all of my other variables. Lastly, the reason I would like to transpose the structure of the data is because with the data being in a long structure, when I run proc freq for any variable such as sex, it counts each observation for the same ID as an individual observation of sex which is not accurate because it's an overestimation. If there's another way to code proc freq, that would be helpful as well but I think transposing the data seems to be the best solution. Thank you in advance for your suggestions and assistance. The code I started and attempted to use is below: /* Converting data from long to wide */
proc transpose data=work.clean out=work.wide (drop=_name_
rename = (col1 = visit_1));
var visit_date;
by id;
run;
proc print data = work.wide;
run;
... View more