Hi,
I am trying to calculate number of comments made per post-I have post-id and data set which only contains comments.
proc means noprint data=comments; by studyid post_id ; var studyid;class week group;
output out=nc_perpost min=xxx; run;
Can anyone help explaining more about "proc means noprint" and how should I verify my code.
Thanks,
proc means data=comments noprint;
by studyid post_id;
class week group;
var studyid;
output out=nc_perpost min=xxx;
run;
Can you also add the code to get mean/std sum for number of participants per post in the same code
proc means data=comments noprint n mean sum std;
by studyid post_id;
class week group;
var studyid;
output out=nc_perpost n= mean= std= sum= / autoname;
run;
Hi @knargis160
I am not sure that PROC MEANS is the better way to do this job.
PROC FREQ or Proc SQL for example could be a better approach to compute frequencies.
Could you please share a sample of data and the desired output?
Can you give a example code in proc sql or proc freq about how to calculate total number of (any variable) per any variable?
https://www.listendata.com/2015/01/sas-detailed-explanation-of-proc-means.html
FREQ won't calculate STD. SQL can but it's not as efficient as PROC MEANS.
My spider sense is tingling. It seems you might need a lot of help on this.
If you want to compute statistics (mean, std, sum) on a numeric variable. that variable has to exist in your data set. I'm not sure from your post that it actually exists. Perhaps your data set has a single observation per post, and you have to count those first.
Does your data set really contain variables named WEEK and GROUP? If so, what do they represent and how do they affect what you want to count?
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.