I am trying to transpose this. There are duplicates within Cardiac disorders. I read on here to make another count variable and put it in the id statement. But that didn't work for me. It is making two columns of aerel and I just need one column!
proc transpose data=temp;
by aeterm_soc count;
var count;
id aerel n;
run;
How do I just get one column for cntNot_Related?
Post usable sample data please 🙂
I put the data in a CSV.
I think I made the dataset wrong. AESEV should not be in there and removing that should take out the duplicates in cardiac disorders.
I am making AE tables like I was asking about in the other post. The duplicate was not supposed to be there. This is why I was asking the best way to count as I have columns for AESEV, and AEREL. I make separate datasets by SOC and PT. I transpose datasets for AESEV and then transpose the datasets for AEREL.The datasets were made with proc sql group by. Once I took AESEV out there were no more duplicates.
These programs are kind of a mess. You can only count once per SOC per PT per subject. Has to be by max severity and max relatedness. My program is quite lengthy so I'm pretty sure there's a better way to do this. Yes, I made one subject-level occurrence flag and I was summing that in SQL to get counts. I kind of need something that's going to work every time because I have to repeat these tables for moderate disease severity, severe disease severity, and all subjects. Additionally, they must be presented separately for treatment A and B. The approach has been to make a dataset for SOC by aesev, PT by aesev, SOC by aerel, and PT by aerel. I transpose the count and percent separately and merge it back together to create 1 dataset. Then I wrote a macro to split out separate datasets by SOC and stack them all together. I make the top row in the table with proc summary. The top row is Any SOC and Any PT.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.