BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Nietzsche
Lapis Lazuli | Level 10

okay I am pulling my hair out on this one.

 

I created some formats in the catalog as shown below, the feefmt and fee_format are my own, the rest are from the prep guide.

the code i used to create my own format is 

proc format lib=formtlib;
value feefmt
	0-<100 = 'low'
	100 - 500 = 'High';
run;

Nietzsche_0-1668308896665.png

 

when I run the following code

 

proc print data=cert.admit;run;

data admit_test;
	set cert.admit;
	format age agegroup. fee feefmt.;
run;
proc print data=admit_test;run;

 

the result I get is this 

Nietzsche_1-1668309024786.png

You can see that the format from the book is success but my own format failed, looking  at the log I got 

Nietzsche_2-1668309098221.png

 

 

I don't understand my format failed, it was successfully loaded into the same directory as the prep guide formats, I don't see any wrong with my format, why did my format failed to load while prep guide worked fine?

 

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Your formats in a custom format library stored in FORMTLIB cannot be used without the FMTSEARCH option being set properly.

 

options fmtsearch=(formtlib);
--
Paige Miller

View solution in original post

11 REPLIES 11
Nietzsche
Lapis Lazuli | Level 10

I deleted the entire catelog and retry again, now, nothing works, I mean it is right there in the when I check fmtlib

proc format lib=formtlib fmtlib; run;

Nietzsche_0-1668311417317.png

you can see the three formats, but when I run

data work.carsurvey;
set cert.cars;
format Sex gender. Age agegroup. Color $col. Income Dollar8.;
run;
proc print data=work.carsurvey;
run;

I get 

Nietzsche_1-1668311470356.png

 

log

 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 70         
 71         data work.carsurvey;
 72         set cert.cars;
 73         format Sex gender. Age agegroup. Color $col. Income Dollar8.;
                       _______
                       484
 NOTE 484-185: Format GENDER was not found or could not be loaded.
 
 73       ! format Sex gender. Age agegroup. Color $col. Income Dollar8.;
                                   _________
                                   484
 NOTE 484-185: Format AGEGROUP was not found or could not be loaded.
 
 73       ! format Sex gender. Age agegroup. Color $col. Income Dollar8.;
                                                   _____
                                                   484
 NOTE 484-185: Format $COL was not found or could not be loaded.
 
 74         run;
 
 NOTE: There were 8 observations read from the data set CERT.CARS.
 NOTE: The data set WORK.CARSURVEY has 8 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              953.90k
       OS Memory           29872.00k
       Timestamp           13/11/2022 03:50:54 AM
       Step Count                        132  Switch Count  2
       Page Faults                       0
       Page Reclaims                     174
       Page Swaps                        0
       Voluntary Context Switches        17
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 75         proc print data=work.carsurvey;
 76         run;
 
 NOTE: There were 8 observations read from the data set WORK.CARSURVEY.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.02 seconds
       user cpu time       0.03 seconds
       system cpu time     0.00 seconds
       memory              2400.84k
       OS Memory           30380.00k
       Timestamp           13/11/2022 03:50:54 AM
       Step Count                        133  Switch Count  0
       Page Faults                       0
       Page Reclaims                     297
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           8
       
 
 77         
 78         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 89         

 

 

 

 

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
Nietzsche
Lapis Lazuli | Level 10

Do I need to? The prep guide never said anything about FMTSEARCH option.

 

In fact it says SAS will search both work and permanent library anyway until the format is found.

Nietzsche_0-1668332049921.png

 

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
PaigeMiller
Diamond | Level 26

Your formats in a custom format library stored in FORMTLIB cannot be used without the FMTSEARCH option being set properly.

 

options fmtsearch=(formtlib);
--
Paige Miller
Nietzsche
Lapis Lazuli | Level 10

thanks, I spent 3 hours on this yesterday

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
FreelanceReinh
Jade | Level 19

@Nietzsche wrote:

Do I need to? The prep guide never said anything about FMTSEARCH option.


If the FMTSEARCH= system option was really not mentioned (I don't have the prep guide), I would rewrite that snippet of section 12.4 as follows:

 

format_search.png

 

Note that the special libref Library is also mentioned in the section "Permanently Storing Your Formats", of which you posted a screenshot in your other thread "few questions regarding to proc format", but it could easily be overlooked if that was the only occurrence.

Nietzsche
Lapis Lazuli | Level 10

IT WAS NOT MENTIONED AT ALL.

Ridiculous that the author would left this out!

 

here is the entire chapter 12 if you wish to search for that option.

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
PaigeMiller
Diamond | Level 26

@Nietzsche 

If this training is produced by SAS , you should notify them of a major omission. If it is produced by some other author, you should notify the author.

--
Paige Miller
Nietzsche
Lapis Lazuli | Level 10

I put all the errata I have found in this thread.  SAS prep guides does not list the name of the author, so hopefully some SAS employee will refer to the SAS department that is responsible for the books to this thread and fix their errors and omissions in the next edition.

 

https://communities.sas.com/t5/SAS-Certification/Errata-for-SAS-Certified-Specialist-Prep-Guide-2019...

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).
Quentin
Super User

SAS will only search for formats that  are in libraries that are in the fmtsearch path.  

 

Since this is for a class, it is possible that the some of the setup code added the formtlib to the search path.

 

To check your fmtsearch setting, you can submit:

%put %sysfunc(getoption(fmtsearch)) ;

and look in the log.  It will show the libraries that are in the search path, and the order in which they are searched. 

 

Another thing to double-check is which directory the formtlib libref points to.  To check that, you can submit:

%put %sysfunc(pathname(formtlib)) ;

and look in the log.  From the instructions in the guide, they say it should point to C:\Users\studen1\formats\lib.

 

When you deleted the catalog (which was a good test to do), did you delete it from that directory or some other directory?

 

BTW, thanks for taking the time to submit a clear question, with code, annotated output, and logs!  This sort of debugging is exactly the kind of thing that will make you pull out your hair, especially in the beginning.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.
Nietzsche
Lapis Lazuli | Level 10

Great explanation by Ron Cody in his book Getting-Started-SAS-Programming-Studio

Nietzsche_0-1669538026409.png

SAS Base Programming (2022 Dec), Preparing for SAS Advanced Programming (Cancelled).

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 11 replies
  • 4883 views
  • 3 likes
  • 5 in conversation