BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

Hi all,

These 2 codes below give me the same results.

What actually is preloadfmt here spposed to do?

What difference is supposed to make?

proc summary data=mylib.testo  completetypes chartype ;

class sex/preloadfmt ;

var height weight;

output out=new max=/autoname;

format sex $gender.;proc print;run;

proc format ;

value $gender 'F'='Female'

             'M'='Male'; run;

VS.

proc summary data=mylib.testo  completetypes chartype ;

class sex ;

var height weight;

output out=new max=/autoname;

format sex $gender.;proc print;run;

proc format ;

value $gender 'F'='Female'

             'M'='Male';

             run;

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

You need to create the format before you use it.

PRELOADFMT allows you to use the format to create something from nothing.   As a test add a level to the 'X'='OTHER' and see what happens.

View solution in original post

5 REPLIES 5
data_null__
Jade | Level 19

You need to create the format before you use it.

PRELOADFMT allows you to use the format to create something from nothing.   As a test add a level to the 'X'='OTHER' and see what happens.

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

sorry,what you mean by create the format before you use it?

I already had a  format below my code.

So yes, with preloadfmt "other" appears in my result eventhough 'X' is nowhere in my inputted data but then why worry about "x" or anyhting that is not in my  data?

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

oh so you are saying in case we want to show a classification level in the outputs  that is not in the data then we use prleoadfmt?

ballardw
Super User

One use, also preloadfmt works in some procedures such as Tabulate that do not have completetypes (actually no types). Completetypes only works in proc means or summary.

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

thank you both

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2202 views
  • 3 likes
  • 3 in conversation