BookmarkSubscribeRSS Feed
Solph
Pyrite | Level 9

Hi,

I grew to like using proc tabulate for output tables, but sometimes it's hard to follow the logic.

Say if I want to run a crosstab of health condition by sex (so column %) for each year and each country. I tried the following but it's giving me the column percent across all cases, not within a country and for each year. How do I change the? I didn't make a sample data but if needed, I could do it.

proc tabulate data=have;

    class country year heath_status sex;

    table (country year _status), sex* COLPCTN;

    run;

Many thanks.

2 REPLIES 2
Ksharp
Super User

What does your data look like ? Maybe you need :

table (country year _status), sex* COLPCTN   all*COLPCTN  ;

Cynthia_sas
SAS Super FREQ

Hi:

  I see that your TABLE statement doesn't have any * (asterisk) operators. Also, you show health_status in the CLASS statement, but then use _status in the TABLE statement. Does your code even produce output? Do you have error messages in the LOG that _status is not defined?

  You can define special denominators for percents using the < and > operators. Generally, you use them in conjunction with nesting using the * operator. The TABULATE documentation has some examples of using a special denominator definition.

Base SAS(R) 9.3 Procedures Guide, Second Edition

cynthia

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 690 views
  • 0 likes
  • 3 in conversation