procedure - SAS Proc-Tabulate to Produce Summary statistics from multiple variables -


i have person level dataset 3 categorical variables v1, v2 , v3. want use proc tabulate calculate means of variable x1, x2, , x3 3 categories listed above count of persons , percentage out of v1 , v2 (i.e when v3 all). here first attempt.

proc tabulate date = in_data               out = out_data;      var x1 x2 x3;       class v1 v2 v3;      table (v1 all) * (v2 all) * (v3 all), n mean pctn<v1 v2>; run; 

this gives me error message “statistics other n requested without analysis variable in following nesting v1*v2*v3*mean”. don’t think have syntax quite right. ideas on how can fix it? thanks.

you need include variables in table statement. think should work:

proc tabulate date = in_data           out = out_data;  var x1 x2 x3;   class v1 v2 v3;  table (v1 all) * (v2 all) * (v3 all), (x1 x2 x3)*(n mean); run; 

this works me:

proc tabulate data = sashelp.class           out = out_data;  var age weight height;   class sex;  table (sex all), (age weight height)*( n mean); run; 

edit:

your issue specific data somehow, you'll have include sample data or there's else going on.

here's reproduction value of 0's , no issues in summary.

data have; i=1 1000; v1=rand('bernoulli', 0.4); v2=rand('bernoulli', 0.7); x1=rand('uniform')*3+1; x2=rand('uniform')*9+1; output; end; drop i; run;  proc print data=have(obs=10); run;  proc tabulate data=have out=check; class v1 v2; var x1 x2; table (v1 all) (v2 all), (x1 x2)*(n mean); run; 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -