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
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.
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.
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.