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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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