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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.