is there any description of the logic of proc tabulate? I doesnt get it, how the logic is with all the brackets...how do I have to set them, where shall I set a Multiplication sign etc.?
For hours I try to get a table like this:
|kreis A||kreis B||kreis C|
But what I get is something like that:
|kreis A||kreis B||kreis C|
I want all the data as percentage (per group; <32h, >32h, total).
I just can't get the Total column to be 100% and each of the two columns ("work") before it. Thats my syntax - pls help me. Thank you!
proc tabulate data=xy; class Wirtschaftsbereich Kreis_3st Arbeit; classlev Wirtschaftsbereich / style=[cellwidth=11cm]; var HRF; table (Wirtschaftsbereich All), HRF*Kreis_3st*(Arbeit RowPctN); format Wirtschaftsbereich Sektor. Arbeit Arbeit. Kreis_3st $Kreis_3st.; run;
Brackets, or probably more correctly parentheses, are used when a group of items are to be used together. Without an explicit description of what you attempt, i.e. given actual input data set and description of denominators and numerator given your subject of "percentage-problem" it is hard to tell where they may be appropriate.
In proc tabulate the * is not a "multiplication" it indicates a nesting level var1*var2*var3 for class variables means levels of Var3 within levels of Var2 within levels of Var1.
Since Proc Tabulate calculates Percent of N and Percent of Sum for table, page, column and/or row and may involve the N or Sum of a specific variable it is very important to clearly define exactly which percentage you are discussing.
When you get results that do not match your desire then provide 1) the code 2) example data in the form of working data step code 3) the definitions of numerator and denominator needed.
I would guess from your output that you likely used PCTN where you want ROWPCTN coupled with All in the correct dimension for the total. Since you don't provide even the names of variables I am not going to guess where you want anything.
Here is small example of tabulate calculating multiple percent of n's with the actual n included so you could check which you want. The SASHELP.CLASS set is small enough you should be able to check some of this by eye or hand calculation easily enough.
proc tabulate data=sashelp.class; class age sex; table age, (sex all)*(n pctn colpctn rowpctn ) ; run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.