Hi all!
If I write this to calculate a percentage in a data step, where do I write the maxdec=2 so that percent_miss is only 2 decimals?
data gaq_4 (drop=_TYPE_ _FREQ_);
set gaq_1 (rename=(_FREQ_=Study_Population));
Percent_Miss=nmiss/Study_Population;
run;
Thank you!!
Are you asking how to round your results to 2 decimal places?
Use the ROUND() function.
Percent_Miss=round(nmiss/Study_Population, 0.01);
MAXDEC is only an option in PROC MEANS.
You use a FORMAT or ROUND in a data step or SQL to limit the decimal places.
Are you asking how to round your results to 2 decimal places?
Use the ROUND() function.
Percent_Miss=round(nmiss/Study_Population, 0.01);
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.