sas >> Proc tabulate out=myfile question

by knvsol » Fri, 05 Mar 2004 22:33:42 GMT

If a teammate outputed a proc tabulate to a SAS data set. Is there an
easy way to take that ouput and use it to create the same table that
was created in his program?
Thank you,

sas >> Proc tabulate out=myfile question

by chang_y_chung » Fri, 05 Mar 2004 23:56:54 GMT



Hi, knvsol,

Hmmm, an interesting question. It will depend on the degree of "sameness"
you are trying to achieve.

The out= option for the proc tabulate stores the value of each cell, the
value of the class variable, and some additional variables (_type_,
_page_, and _table_).

So, you lose all the tweaking of the display, like cell width or which
formchars you are using.

In addition, those additional variables don't have enough details to
remember which class variable goes on rows and which goes to columns. For
example, the following two generates exactly the same out= file.

HTH

Cheers,
Chang

<sasl:code>
proc tabulate data=sashelp.class out=myTab1;
class sex age;
var weight;
table sex*age*weight;
run;
proc tabulate data=sashelp.class out=myTab2;
class sex age;
var weight;
table sex, age*weight;
run;

proc compare base=myTab1 compare=myTab2;
run;
/* the last line on lst
NOTE: No unequal values were found. All values compared are exactly equal.
*/
</sasl:code>

Similar Threads

1. PROC TABULATE or PROC REPORT : newby question

Hi All

I want to make a report which uses up to 3 different formats to show
the same data. I have articles which can be divided in 3 groups and I
want to see all the 3 groups using 3 differents formats in the same
report.
For example :
|---------------------------------------------------------------------------------------------|
|                              | Public  | Private | Cat1  | Cat2
| ... | Catn  |
| Article 1 | OK         |            |            |
|          |     |          |
|              | Not OK   |            |            |
|          |     |          |
|              | Total       |            |            |
|          |     |          |
|---------------------------------------------------------------------------------------------|
| Article 2 | OK         |            |            |
|          |     |          |
|              | Not OK   |            |            |
|          |     |          |
|              | Total       |            |            |
|          |     |          |
|---------------------------------------------------------------------------------------------|
...

Thanks in advance for your help !

Regards,

Christophe Paratte

2. Question on Proc Freq, Proc Tabulate, and reporting..

3. Proc Tabulate Question ??

Hello _all_,
Here is sample code  I am using as I am new Proc Tabluate I am not sure what
happening here in when I am running same piece of code using no formats i am
getting 158 Observations from Proc tablate PROCEDURE but with applying
Formats I am getting Less I need get 158 observations with the Formats
applied  Is there  way I can do  it . ??

Is there Equivalent Code for this Tabulate code I know it is Simple Freq
count but I am not Sure what this guy is doing using  this format inside the
Procedure ?? Just Lost
___________________________________________________________________________________
My Format looks like this

Proc Format ;
       value ndosef(multilabel)
            low- 0   =  'No Dose '
           1 - high  = 'At least  1 dose'
           2 - high  = 'At least  2 doses'
           3 - high  = 'At least  3 doses'
           4 - high  = 'At least  4 doses'
           5 - high  = 'At least  5 doses'
           6 - high  = 'At least  6 doses'
           7 - high  = 'At least  7 doses' ;
Run;


NOTE: There were 9825 observations read from the data set WORK.TABLE.
NOTE: The data set WORK.TABLE1 has 514 observations and 29 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1839  proc tabulate data = table_rep2  format = 6.2 missing
1840                       out = tab_rep2(drop = _type_ _page_ _table_
rename =
1840! (PctN_01 = PCTN)) ;
1841     class cnt_dose trtan/mlf ; *preloadfmt;
1842     table (trtan all*f=7.2), cnt_dose*(N*F=9. rowpctn*F=7.2)/rts=40
1842! printmiss misstext = 'none';
1843  format cnt_dose ndosef. ;
1844  run;

NOTE: There were 514 observations read from the data set WORK.TABLE1.
NOTE: The data set WORK.TAB_REP2 has 156 observations and 5 variables.
NOTE: PROCEDURE TABULATE used (Total process time):

_____________________________________________________________

With Applying Formats

NOTE: There were 9825 observations read from the data set WORK.TABLE.
NOTE: The data set WORK.TABLE_REP2 has 514 observations and 29 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


3025  proc tabulate data = table_rep2  format = 6.2 missing
3026                       out = tab_rep2(drop = _type_ _page_ _table_
rename =
3026! (PctN_01 = PCTN)) ;
3027     class cnt_dose trtan/mlf ; *preloadfmt;
3028     table (trtan all*f=7.2), cnt_dose*(N*F=9. rowpctn*F=7.2)/rts=40
3028! printmiss misstext = 'none';
3029  format cnt_dose ndosef. ;
3030  run;

NOTE: Multiple concurrent threads will be used to summarize data.
NOTE: Formatting exceptions occurred during data classification for variable
      CNT_DOSE. The format width was probably too small for one or more of
the
      values.
NOTE: There were 514 observations read from the data set WORK.TABLE_REP2.
NOTE: The data set WORK.TAB_REP2 has 68 observations and 5 variables.
NOTE: PROCEDURE TABULATE used (Total process time):
      real time           0.04 seconds
      cpu time            0.04 second

4. proc tabulate, sum/pctsum question

5. Proc Tabulate Question: how to use the result categories as

Not sure if this can be done by tabulate alone. But if you can
accept one data step to pre-process the data (transpose), then
here is the code:

data xx;
array qq q1-q5;
do row=1 to 10;
 do q=1 to 5;
  qq(q)=ceil(ranuni(3)*5);
 end;
  output;
end;
drop row q;
run;

proc print;
run;

data txx;
 set xx;
array qq q1-q5;
do over qq;
val=qq;
qnm=vname(qq);
output;
end;
keep qnm val;
run;

proc tabulate data=txx noseps;
class qnm val;
table qnm, val=''*n='';
run;

 q1    q2    q3    q4    q5

  3     5     1     4     4
  5     4     3     1     1
  3     3     3     2     5
  5     5     1     5     4
  1     2     4     5     3
  3     5     4     4     1
  1     3     4     4     4
  5     1     3     1     3
  3     4     5     5     4
  4     1     3     3     2

 -----------------------------------
 |        | 1  | 2  | 3  | 4  | 5  |
 |--------+----+----+----+----+----|
 |qnm     |    |    |    |    |    |
 |q1      |   2|   .|   4|   1|   3|
 |q2      |   2|   1|   2|   2|   3|
 |q3      |   2|   .|   4|   3|   1|
 |q4      |   2|   1|   1|   3|   3|
 |q5      |   2|   1|   2|   4|   1|
 -----------------------------------


On Wed, 28 May 2008 11:31:36 -0500, Mary < XXXX@XXXXX.COM > wrote:

>I know I've seen this done, was wondering if any of you had any examples
of doing this:
>
>Suppose I have several hundred variables, and I want to produce in Proc
tabulate their frequency results.  For simplicity, let's say this is a
likert scale:
>
>5=Excellent
>4=Very Good
>3=Good
>4=Poor
>5=Very Poor
>
>
>Is there some way I can get the frequencies of the results for each
question:
>
>
>Column header desired :   Excellent  Very Good  Good  Poor  Very Poor
>Row 1: Question1 percents  30.0 20.0 20.0 30.0 0.0
>Row 2: Question 2 percents 90.0 10.0 0.0 0.0 0.0
>Row 3: Question 3 percents 95.0 5.0 0.0 0.0 0.0
>Row 4: Question 4 percents 0.0 0.0 0.0 5.0 95.0
>
>So there would be as many rows per question down, and in this example the
percents across would add to 100% across the row.
>
>Anyone?
>
>-Mary

6. Proc Tabulate Question: how to use the result categories as the

7. Questions about PROC TABULATE

Hi everyone,

  I'd like to create a tabular report using PROC TABULATE and using ODS output to an Excel sheet. I have encountered two problems that I cann't find the solution.

  The first problem I have is: the text of title in the final Excel report all wrapped up in one single cell, I want to know whether it's possible to create a title automatically across multiple cells rather than wrapped up in on cell.

  The second problem is: I want the class variable level values left justified in the report, I used STYLE statement in the CLASSLEV, but no matter how I change it, the class level values always centered. Does anyone know the reason?  The following is the code I used.

  Thanks in advance!

  Nancy


  ods listing close;
  ods html body="C:\test_report.xls";

  title j=left font='Times New Roman' bold height=10pt 'Health Care Inpatient Utilization Report';
  title2 j=left font='Times New Roman' bold height=10pt 'Jan to Oct 2007 Compared to Jan to Oct 2006';

  proc tabulate data=test1 order=data missing style=[font_size=1];
  class yos measure report_cat repgrpid / style=[just=left font_size=1 font_face = Times];
  classlev yos measure report_cat repgrpid / style=[just=left font_size=1 font_face = Times];
  var var1;
  table (yos='') * (measure='') * (report_cat='')
  ,
  (repgrpid='') * (var1='')* sum='' ;
  run;
  ods html close;
  ods listing;



---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.

8. Simple Proc Tabulate question