Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAS output

Status
Not open for further replies.

iren

Technical User
Mar 8, 2005
106
US
Hi everybody,

I generated datasets : denom1, denom2, denom3 as well as num1, num2, num3 for both products: Comm and Med

How can I implement code to get an output in table format . Somewhat like the following or any other kind of readable format in SAS output?

Comm Med
***************************************************
Percent=num1/denom1 Percent=num1/denom1
Percent=num2/denom2 Percent=num2/denom2
Percent=num3/denom3 Percent=num3/denom3

Thank you in advance,

Iren
 
There's a whole slew of ways to output data, proc print, proc report or using a data _Null_ step and directing the output to a file (which can be the output window).
If you're just after really basic text output, and there's not too much, you can use PUT statements in the data_null_ step like this:-
Code:
data _null_;
  file print;

  put "Percent=num1/denom1                            Percent=num1/denom1";
  ...
run;

Alternatively, if you want funky looking output you can use proc print or proc report to right out the data to HTML or Excel or just the output window.


Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Chris, after I run the code I got the following output:

Percent=num1/denom1 Percent=num1/denom1
Percent=num2/denom2 Percent=num2/denom2
….

In other words I did not get any numbers…..while my num1; denom1; num2; den2 are definitely numbers.

What do you think I am doing wrong?
Thank you in advance,

Iren

 
Try:-
Code:
data _null_;
  file print;

  put @1  "Percent=" num1 "/" denom1
      @30 "Percent=" num2 "/" denom2;
  ...
run;
The @1 and @30 are column pointers and tell SAS where to start writing the data to. because num1 etc aren't in quotes, they get translated and get their values written out.
For more information on how to write out data like this, check this out:-
You can create some fairly complex reports like this, however, they will be plain text format. ODS is the way to go if you wnt to write out reports to HTML, Excel PDF etc.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top