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

Hi,

 

I am trying to associate the permanently saved user defined formats in data step with the dataset from sashelp.cars;

 

created the format as below-

 

PROC FORMAT LIBRARY=SDTM.FRMT1;
 VALUE MSRPFMT
  0-<20000="CHEAP AND BEST"
  20000-<40000="AFFORDABLE"
  40000-HIGH="LUXURY";
 RUN;

 

PROC FORMAT LIBRARY=SDTM.FRMT1;
 VALUE $ORIGINFMT
  "Asia"="PART'S FROM ASIA"
  "USA"="ASSEMBLED IN USA"
  "Europe"="VALIDATED IN EUROPE";

RUN;

 

to assign the format in data step-

 

DATA CARS ;
SET SASHELP.CARS (OBS=10) ;
FORMAT MSRP MSRPFMT. ORIGIN ORIGINFMT.;
RUN;

 

the log says-

 

ERROR 48-59: The format MSRPFMT was not found or could not be loaded.

62 ! FORMAT MSRP MSRPFMT. ORIGIN ORIGINFMT.;
                                 ----------
                                 48
ERROR 48-59: The format $ORIGINFMT was not found or could not be loaded.

63   RUN;

 

could someone help in finding what did i miss in the code?

 

Thanks

Eram

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

You'll need a slightly more complex statement:

 

OPTIONS FMTSEARCH=(SDTM.FRMT1);

 

The default name of the format catalog (if you were to specify SDTM only) is FORMATS, not FRMT1.

View solution in original post

4 REPLIES 4
LinusH
Tourmaline | Level 20

You need the dollar sign in the format name when you assign it as well.

Be sure to point out your format location with FMTSEARCH global option.

Data never sleeps
Eram
Fluorite | Level 6

updated the code as sggested with option= fmtsearch and $ sign in format name as -

OPTIONS FMTSEARCH=FRMT1;
DATA CARS;
SET SASHELP.CARS;
FORMAT MSRP MSRP. ORIGIN $ORIGINFMT.;
RUN;

 

 

log still says error-

DATA CARS;
SET SASHELP.CARS;
FORMAT MSRP MSRP. ORIGIN $ORIGINFMT.;
                 -----
                 48
ERROR 48-59: The format MSRP was not found or could not be loaded.

181! FORMAT MSRP MSRP. ORIGIN $ORIGINFMT.;
                              -----------
                              48
ERROR 48-59: The format $ORIGINFMT was not found or could not be loaded.

182  RUN;

Ksharp
Super User
OPTIONS FMTSEARCH=(SDTM) ;
Astounding
PROC Star

You'll need a slightly more complex statement:

 

OPTIONS FMTSEARCH=(SDTM.FRMT1);

 

The default name of the format catalog (if you were to specify SDTM only) is FORMATS, not FRMT1.

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!

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.

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
  • 4 replies
  • 705 views
  • 1 like
  • 4 in conversation