Send the output to a data set an use one of the proc reports such as Print, Report or Tabulate to display the values where you can set the display formats would likely be the best approach. Add statements such as
ODS OUTPUT tablename= wanteddatasetname;
Table name would likely be CROSSTABS if doing two-way frequencies, ONEWAY if single , CHISQ or CHISQ1 if doing chi-square tests.
Or you can run your code preceded with ODS Trace on; prior to the procedure to get a listing of tables generated. Don't forget to use ODS Trace off; afterwards.
Otherwise you have to work with Proc Template to modify the displayed tables layouts and that is usually way more work than it is worth.
Send the output to a data set an use one of the proc reports such as Print, Report or Tabulate to display the values where you can set the display formats would likely be the best approach. Add statements such as
ODS OUTPUT tablename= wanteddatasetname;
Table name would likely be CROSSTABS if doing two-way frequencies, ONEWAY if single , CHISQ or CHISQ1 if doing chi-square tests.
Or you can run your code preceded with ODS Trace on; prior to the procedure to get a listing of tables generated. Don't forget to use ODS Trace off; afterwards.
Otherwise you have to work with Proc Template to modify the displayed tables layouts and that is usually way more work than it is worth.
@Orchidn wrote:
Thank you so much! It worked, but there are still variables which were mot converted to 2 digits (the ones that are by default in the crosstab).
The table won't change the number of decimals though the number displayed may vary from the table output. You specify that in Proc Print, Report or tabulate. Or you could use Proc DATASETS or a data step (inefficient) to assign formats to specific variables.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.