SAS Enterprise Guide 7.11
Hi, I have questions.
1. I want to create a table which I want to create. but i don't know how to do. PLZ let me know 😞
original dataset :
ID A1 A2 A3 ... A91 An : disease name
-------------------------------------
1 1 1 1 0 1:disease o
2 0 1 0 1 0:disease x
.
.
.
910000 1 0 1 0
TABLE which i want to create :
disease1 disease2 count phi coefficient
-----------------------------------------------------------
A1 A2 30 0.012
A1 A3 20 0.033
:
A1 A91 100 0.223
A2 A3 40 0.111
:
A2 A91 200 0.333
:
A90 A91 100 0.445
2. I've already tried these proc steps.
proc table;
table A1*(A2-A91);
output out=a / chisq;
run;
but i don't know next steps.
and i know i have to use 'proc tamplate step' but i don't know how to do. plz help me.
Hi,
I think in your code you meant to say:
proc freq data=<dataset>; tables A1*(A2-A91); output out=a / chisq; run;
Or something similar to that. On a secondary note, proc template is used to create templates, be them style templates, graph templates or table templates. You do not *need* to use them at all, although they are helpful to get output to look a certain way.
Next up I would suggest you post test data as a datastep, follow this post:
So we can run code against it.
How do you get that COUNT variable. I also notice you want PI coefficient. data have; input ID A1 A2 A3 A4; cards; 1 1 1 1 0 2 0 1 0 1 3 1 1 1 1 4 0 0 1 0 5 1 1 0 0 6 1 0 1 1 7 1 0 1 1 8 0 0 0 0 9 0 1 1 1 11 1 1 1 0 12 1 1 1 1 13 1 0 1 0 14 0 1 1 1 15 1 1 0 0 16 1 1 1 0 17 0 1 1 1 18 1 1 1 0 ; run; data temp; set have(drop=id); array x{*} A:; length vname1 vname2 $ 40; do i=1 to dim(x); vname1=vname(x{i}); value1=x{i}; do j=i+1 to dim(x); vname2=vname(x{j}); value2=x{j}; output; end; end; keep vname1 vname2 value1 value2; run; proc sort data=temp; by vname1 vname2 value1 value2; run; proc freq data=temp noprint; tables vname1*vname2/out=temp1 list; run; proc freq data=temp noprint; by vname1 vname2 ; table value1*value2/chisq; output out=temp2 phi; run; data want; merge temp1 temp2; by vname1 vname2; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.