Skip to content

Instantly share code, notes, and snippets.

@statgeek
Created September 21, 2019 18:57
Show Gist options
  • Save statgeek/2c516b2ad904c5209b0ef693f3e13e5d to your computer and use it in GitHub Desktop.
Save statgeek/2c516b2ad904c5209b0ef693f3e13e5d to your computer and use it in GitHub Desktop.
SAS - Preloadfmt - reporting values not in data
/*This demonstrates how to ensure all levels are in your report
using the preloadfmt option*/
data raw;
input person firsttest $ secondtest $;
datalines;
1 Good Good
2 Poor Good
3 Good Bad
4 Poor Bad
5 Poor Poor
;
run;
proc format;
value $ test_values
"Good" = "Good"
"Poor" = "Poor"
"Bad" = "Bad";
run;
proc tabulate data=raw;
class firsttest secondtest / preloadfmt;
table firsttest, secondtest / misstext='0' printmiss;
format firsttest secondtest $test_values.;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment