Hi,
my data have:
| age_group | P_erw | col3 | col4 | col5 | tab |
| 15-25 | 166.385841 | 100 | . | 00 | |
| 15-25 | 01_ET | 69.121421 | . | 41.542850392 | 00 |
| 15-25 | 02_EL | 5.001954 | . | 3.0062377724 | 00 |
| 15-25 | 03_NEP | 92.262466 | . | 55.450911836 | 00 |
| 15-25 | 160.490773 | 100 | . | 01 | |
| 15-25 | 01_ET | 66.408964 | . | 41.378680381 | 01 |
| 15-25 | 02_EL | 4.57421 | . | 2.8501389298 | 01 |
| 15-25 | 03_NEP | 89.507599 | . | 55.77118069 | 01 |
| 15-25 | 5.895068 | 100 | . | 02 | |
| ... | ... | ... | ... | ... | ... |
What I want is an output with proc-tabulate and I use the following code:
proc tabulate data=test;
class tab age_group P_erw;
var col3 col4 col5;
table age_group*tab,col3 col4 P_erw*(col3 col5);
run;
The result is what I want, except col4. This column has dots. The number 100 is not in. My question: Why is it missing and how can I integrate it? Thank you!
(in favor of the overview I replaced the results with an x)
The default behavior of Proc Tabulate is any observation that has a missing value for a Class variable is excluded from the report.
See if this gets closer to what you expect:
proc tabulate data=test; class tab age_group; class P_erw / missing; var col3 col4 col5; table age_group*tab,col3 col4 P_erw*(col3 col5); run;
The option / missing for P_erw allows missing values of P_erw to remain in the report. This will mean that you have a column where P_erw is missing as it also means that becomes a valid level. If that is not what you want you may need to go back in the creation of that data set as it appears that you may have done some sort of summary to create a "total row" for each level of age_group. Proc tabulate might give you that with the ALL instruction. Maybe. Col4 looks like some sort of percent and looks, in your limited data example, to be very uninteresting and maybe could be calculated by Tabulate but we would need to see more actual data and what you expect the output table to show.
@Konkordanz wrote:
Hi,
my data have:
age_group P_erw col3 col4 col5 tab 15-25 166.385841 100 . 00 15-25 01_ET 69.121421 . 41.542850392 00 15-25 02_EL 5.001954 . 3.0062377724 00 15-25 03_NEP 92.262466 . 55.450911836 00 15-25 160.490773 100 . 01 15-25 01_ET 66.408964 . 41.378680381 01 15-25 02_EL 4.57421 . 2.8501389298 01 15-25 03_NEP 89.507599 . 55.77118069 01 15-25 5.895068 100 . 02 ... ... ... ... ... ...
What I want is an output with proc-tabulate and I use the following code:
proc tabulate data=test; class tab age_group P_erw; var col3 col4 col5; table age_group*tab,col3 col4 P_erw*(col3 col5); run;
The result is what I want, except col4. This column has dots. The number 100 is not in. My question: Why is it missing and how can I integrate it? Thank you!
(in favor of the overview I replaced the results with an x)
The default behavior of Proc Tabulate is any observation that has a missing value for a Class variable is excluded from the report.
See if this gets closer to what you expect:
proc tabulate data=test; class tab age_group; class P_erw / missing; var col3 col4 col5; table age_group*tab,col3 col4 P_erw*(col3 col5); run;
The option / missing for P_erw allows missing values of P_erw to remain in the report. This will mean that you have a column where P_erw is missing as it also means that becomes a valid level. If that is not what you want you may need to go back in the creation of that data set as it appears that you may have done some sort of summary to create a "total row" for each level of age_group. Proc tabulate might give you that with the ALL instruction. Maybe. Col4 looks like some sort of percent and looks, in your limited data example, to be very uninteresting and maybe could be calculated by Tabulate but we would need to see more actual data and what you expect the output table to show.
@Konkordanz wrote:
Hi,
my data have:
age_group P_erw col3 col4 col5 tab 15-25 166.385841 100 . 00 15-25 01_ET 69.121421 . 41.542850392 00 15-25 02_EL 5.001954 . 3.0062377724 00 15-25 03_NEP 92.262466 . 55.450911836 00 15-25 160.490773 100 . 01 15-25 01_ET 66.408964 . 41.378680381 01 15-25 02_EL 4.57421 . 2.8501389298 01 15-25 03_NEP 89.507599 . 55.77118069 01 15-25 5.895068 100 . 02 ... ... ... ... ... ...
What I want is an output with proc-tabulate and I use the following code:
proc tabulate data=test; class tab age_group P_erw; var col3 col4 col5; table age_group*tab,col3 col4 P_erw*(col3 col5); run;
The result is what I want, except col4. This column has dots. The number 100 is not in. My question: Why is it missing and how can I integrate it? Thank you!
(in favor of the overview I replaced the results with an x)
Great, thank you!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.