frequency - sas how to do frequencies for only certain values -


i have survey data possible responses, example be:

         q1 person1  yes person2  no person3  missing person4  multiple marks person5  yes 

i need calculate frequencies question, yes/no (other questions have varied responses such frequently, frequently, etc) counted in totals - not ones multiple marks. there way exclude these using proc freq or method?

outcome:

yes: 2 no: 1 total: 3 

using proc freq, i'd this:

proc freq data=have (where=(q1 in ("yes", "no"))); tables q1 / out=want; run; 

output:

q1  count   percent no  1   33.333333333 yes 2   66.666666667 

proc sql:

proc sql; select      sum(case when q1 eq "yes" 1 else 0 end) yes     ,sum(case when q1 eq "no" 1 else 0 end) no     ,count(q1) total have q1 in ("yes", "no"); quit; 

output:

yes no total  2 1 3  

Comments

Popular posts from this blog

Capture and play voice with Asterisk ARI -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -