Hi all; I want to know if there is another better way to add the group number easily,when using the PROC FREQ procedure to caculate the P value.
If I understand correctly, you're starting with the data set you have shown, minus the A and B columns. Depending on what they are supposed to contain (you really have shown just an abbreviated version), here is one way to add them:
data want;
set have;
by trt notsorted;
if first.trt then do;
A + 1;
B = 1;
end;
else B + 1;
run;
Even if this isn't the right result, you will probably need some variation on these tools to get what you want.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.