BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Altal
Calcite | Level 5

I'm using PROC TABULATE to output a dataset and I don't want the TABULATE table to show in RTF or output i.e. I just want it to spit the dataset. Is there anyway to do that? looks like TABULATE has no NOPRINT equivalent

I'm using the code below and it doesn't serve the purpose...

ODS RTF file='PATH/.rtf'

ODS LISTING CLOSE;

proc tabulate data=DATA out=WANT;

  class

  tables Var , Var * (n pctn=''*f=pctfmt.) ;

run;

ODS LISTING;

ODS RTF CLSOE;

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Use the ODS Select statement

ods select none;

proc tabulate data=sashelp.class out=want;

class sex age;

tables sex age, n;

run;

ods select all;

View solution in original post

7 REPLIES 7
Cynthia_sas
SAS Super FREQ


Hi:

  I don't know what you mean by "spit the dataset" -- you're going to need PROC PRINT for that -- there is no "spitting" to a destination without a procedure that creates output. I would suggest this instead. Move the TABULATE step outside of your ODS "sandwich" and then put your PROC PRINT "inside" the ODS statements.

Cynthia
   

ods listing;

** run tabulate and make the dataset work.want;

proc tabulate data=DATA out=WANT;

  class

  tables Var , Var * (n pctn=''*f=pctfmt.) ;

run;

 

ODS LISTING CLOSE;
   

ODS RTF file='PATH/.rtf'

proc print data=work.want;

run;

ODS RTF CLOSE;

Reeza
Super User

Use the ODS Select statement

ods select none;

proc tabulate data=sashelp.class out=want;

class sex age;

tables sex age, n;

run;

ods select all;

GiridharGoutham
Calcite | Level 5

Hello All,

Thank You very much for helping me through this type of output .

I have been working on text pad and as I use this tabulate I would get all the unwanted stuff .Any ways it was very much helpful.

Thanks a Lot.

Giridhar Goutham Y

jakarman
Barite | Level 11

With some languages "spit" (spitten nl) should be translated to dig (en),  more advanced that is "data mining".

---->-- ja karman --<-----
Altal
Calcite | Level 5

Sorry for the language, I meant for the proc tabulate to output the dataset I wanted without printing it in the rtf output. Cynthia, thanks for your suggestion; but I couldn't take the tabulate proc outside the ODS since it's inside a macro. I implemented Reeza's code and it works. Thank you all.

Cynthia_sas
SAS Super FREQ

Hi:

  You must be using some other code to get the dataset to appear in the RTF file. When I implement Reeza's code in this sample program, my RTF file is empty. See screen shot.

Cynthia

     
ods _all_ close;
ods rtf file='c:\temp\what_report.rtf';
  ods select none;

    proc tabulate data=sashelp.class out=want;
      class sex age;
      tables sex age, n;
    run;

  ods select all;
ods rtf close;


empty_report.png
Altal
Calcite | Level 5

That's exactly what I wanted (for proc tabulate to do the tabulation, give me the dataset in the OUT= and not to print anything in the RTF; then I'm using the dataset for other calculation). I appreciate the response.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 7 replies
  • 26373 views
  • 10 likes
  • 5 in conversation