BookmarkSubscribeRSS Feed
PICKME
Calcite | Level 5

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. 

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

So we can run code against it. 

Ksharp
Super User
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;


sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 966 views
  • 0 likes
  • 3 in conversation