Hello,
I have a dataset I am working with where I have calculated completion or a variable (yes/no) by type of visit (remote/in-person). I have multiple variables I am assessing for completion and have used the below code to do this. I now need to sum the completion percent for each of these assessments into an overall completion rate. Can anyone help me figure out how to do this? Thanks.
proc freq data=dataseta; table visit_typescreen*strokedx visit_typescreen*timenihss visit_typescreen*mostnihss visit_typescreen*marissnihss; run;
Example input data and expected output would be helpful.
In case you didn't know Proc Freq supports some short cuts such as
proc freq data=dataseta; table visit_typescreen*(strokedx timenihss mostnihss marissnihss); run;
You can use multiple groups of variables withing parentheses to get lots of crosses, everything in group1 with everything in group2 (and more).
Thanks for the shortcuts. For example, if my output is:
visit type strokedx
Yes No
In person 5 3 8
Remote 7 2 9
12 5 17
and
visit type NIHSS
Yes No
In person 4 4 8
Remote 8 1 9
12 5 17
I want to establish the % complete for in-person and remote visits totaled:
In person (5+4)/8*100
Remote (7+8)/9*100
This is obviously easy to do by hand or in excel, there will just be a lot more variables I need calculated in this total, so I was wondering if there is a quick way to code this in excel. Thanks.
edit:
I want to establish the % complete for in-person and remote visits totaled:
In person (5+4)/16*100
Remote (7+8)/18*100
I need the percentages from each individual variable cross tab, and the code I wrote achieves this fine. I also need percentages from all of the cross tabs summed up. Wondering how to achieve the summation of each separate analysis.
Wouldn't that just be this then? The second table should have the stats you seem to want.
proc freq data=dataseta;
table visit_typescreen*(strokedx timenihss mostnihss marissnihss);
table visit_typescreen;
run;
By example data I meant the Dataseta, not the summary.
Best would be as a data step. Your summary is not possible to tell which of your variables with NIHSS as part of name are included.
Something like which does not duplicate your numbers, just an example of what the data step should look like.
data example; infile datalines dlm=','; input visit_typescreen :$10. strokedx $ timenihss $; datalines; In person,Yes,Yes In person,Yes,Yes Remote,Yes,Yes Remote,Yes,Yes Remote,Yes,Yes Remote,Yes,Yes In person,Yes,No Remote,Yes,No In person,Yes,No Remote,No,Yes In person,Yes,No Remote,Yes,No In person,No,Yes Remote,No,Yes In person,No,No Remote,No,No In person,No,No Remote,Yes,No ;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.