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

Hello All,

 

I have the dataset below

dataset.PNG

 

...and I have been asked to present/generate a table like the one below.

report.PNG

 

I have played around with proc report but no luck yet. I don't know how to manipulate the data so that the numbers are placed in the right column/rows within my report.

 

I will appreciate some help.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
PROC FREQ output does that by default so pipe the results directly to a file or use PROC TABULATE but both will have the same issue.

ods excel file='/folders/myfolders/demo.xlsx' style=journal;
proc freq data=nameOfYourDataSet;
table ebola*truth / nopercent norow nocol;
run;
ods excel close;

View solution in original post

5 REPLIES 5
Reeza
Super User
PROC FREQ output does that by default so pipe the results directly to a file or use PROC TABULATE but both will have the same issue.

ods excel file='/folders/myfolders/demo.xlsx' style=journal;
proc freq data=nameOfYourDataSet;
table ebola*truth / nopercent norow nocol;
run;
ods excel close;
nduksy
Obsidian | Level 7

The first picture I posted is from a proc freq action.

 

I'll appreciate if you can help with some more clarity per using proc tabulate to produce a similar report as contained in the second picture.

 

Thanks

ballardw
Super User

@nduksy wrote:

The first picture I posted is from a proc freq action.

 

I'll appreciate if you can help with some more clarity per using proc tabulate to produce a similar report as contained in the second picture.

 

Thanks


Actual data please. As in a data step to create a data set.

 

If you want to use Proc Tabulate you might be better off using the source data instead of Proc Freq output, if that is the request. Do you want the counts? the Percents? it is not clear what expect Proc Tabulate to create as there are NO VALUES in the table. Your example also implies that the Ebola Negative results are supposed to be suppressed (not shown) but have a row in the data.

nduksy
Obsidian | Level 7

Thank you so much, that actually worked perfectly!!!

Reeza
Super User
Did you run the code I included and check the output?

PROC FREQ has two outputs, one creates a data set in more of a data format and their is the displayed format. The one you have shown is similar to the displayed format, which you can pipe directly to an output file.

We're happy to help but you've posted images. To 'help you with exact code' would mean having to literally type out your data shown to create the sample data, write the code AND show the output (since the code is already above), and I'm sure why you can see why posting data as text, preferably a data step would be easier to get help.

If that code doesn't work, please explain why in detail. Saying something does not work is not informative, it could mean anything from your computer exploded to a missing semicolon. Ideally, provide what you have, the starting point, what you want and what you've tried so far.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1059 views
  • 1 like
  • 3 in conversation