Hi SAS experts,
I have a dataset that has gender groups (0, 1) nested in departments.
I'd like to use Proc Tabulate to generate some reports by department and by gender.
Here is what I need to produce:
Table 1:
Account department, Male
N, 1 Year Retention, 2 Year Retention
20, 20%, 30%
Table 2:
Account department, Female
N, 1 Year Retention, 2 Year Retention
40, 22%, 30%
Table 3:
Payroll department, Male
N, 1 Year Retention, 2 Year Retention
40, 21%, 10%
etc. etc..
However, using proc tabulate
by department gender ;
Gives me tables in the following undesired order:
Account department, Male
Payroll department, Male
Account department, Female
Payroll department, Female
etc.
I really want:
Account department, Male
Account department, Female
Payroll department, Male
Payroll department, Female
How do I fix this?
Thanks so much!
From what you write your output should be as desired. Do your variables have formats perhaps? The ordering can be accordiung to unformatted values. Anyways please share your code and data. No doubt with more info the issue will be resolved quickly.
Regards, Jan.
Show the exact code you used. The order of variables in the table statement is important. And while Tabulate will supporat BY variables often it is best to use those as CLASS variables and provide them in a page dimension.
Order of appearance will depend upon Order=options and the order variables appear in parts of the proc.
If you provide some example data in the form of a datastep we can test and provide exact code.
1)Use proc tabulate option : Order=DATA 2)Padding some white blank before the value to customize the order .
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!
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.