BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RobertWF1
Quartz | Level 8

I'm running a prior employee's SAS code for generating ICD-9 and ICD-10 diagnosis code categories and came across this code:

 

data mbr_dx2;
set mbr_dx2;
    if icd_version=9 then elix=put(diagnosis,$RCOM9FMT.);
    else if icd_version=10 then elix=put(diagnosis,$RCOM10FMT.);
    if elix ne '';
    cnt=1;
run;

SAS doesn't recognize the $RCOM9FMT. and $RCOM10FMT. formats - where did these come from?

 

Are they old diagnosis code formats no longer supported by SAS?

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

I haven't heard of these. Is it possible that they are custom-defined formats within your organization? Something that a prior team member built using PROC FORMAT?

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.

View solution in original post

6 REPLIES 6
ChrisHemedinger
Community Manager

I haven't heard of these. Is it possible that they are custom-defined formats within your organization? Something that a prior team member built using PROC FORMAT?

Learn from the Experts! Check out the huge catalog of free sessions in the Ask the Expert webinar series.
RobertWF1
Quartz | Level 8

Yes I bet that's it - I'll see if I can hunt down the proc format.

 

I don't see it in the current program, but custom formats still work in your session even if generated in another program, correct?

Tom
Super User Tom
Super User

Those are user defined formats.

 

You need to find the code that creates those formats so you can create the formats in a catalog that is included in the list of catalogs listed in the FMTSEARCH system option.

 

If you cannot find the code then you need to find the format catalog where they are stored.  If that format catalog can by read by the version of SAS you are now using (catalogs are not interoperable across SAS versions) then you can access them by making sure the catalog is included in the set of catalogs listed in the FMTSEARCH system option.

RobertWF1
Quartz | Level 8
Thanks Tom - I did find an options statement in the program:

options obs=max compress=yes fmtsearch=(out);

that allowed me to read in the formats. But it's still a mystery where the original proc format or format catalog is located - would it be in one of the default SAS folders?
ballardw
Super User

@RobertWF1 wrote:
Thanks Tom - I did find an options statement in the program:

options obs=max compress=yes fmtsearch=(out);

that allowed me to read in the formats. But it's still a mystery where the original proc format or format catalog is located - would it be in one of the default SAS folders?

If that allows you to find the formats then they are almost certainly in a catalog named Formats in the OUT library.

 

Suggestion: Use Proc Format with the cntrlout option to create a data set with the definition of the formats:

Proc format library=out cntlout=FormatDef;
run;

That way you can recover the formats if you migrate SAS as that data set can be used to rebuild the format catalog if needed. This may be very important if you cannot find the code used to create the formats.

Tom
Super User Tom
Super User

When you use a single name like that in the FMTSEARCH option list then means you want the FORMATS catalog in that libref.  So OUT is the name of the LIBREF that points to the location where the format catalog is stored.  If you do not see the LIBNAME statement that created the OUT libref then you can ask SAS to show you be using the LIST option of the LIBNAME statement.

libname out list;

The Physical Name= line will show you the name of the directory where to find the formats.sas7bcat file.

 

If you cannot find the source code then save the format definition out as a SAS dataset and then the format(s) will be more portable.   

 

For example this code will create a dataset named FORMATS in the OUT libref that contains the information needed to recreate the catalog OUT.FORMATS.

proc format library=out.formats cntlout=out.formats noprint;
run;

Later if you move to a different version of SAS you could re-create the format catalog by reversing the process:

proc format library=out.formats cntlin=out.formats noprint;
run;

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
  • 6 replies
  • 902 views
  • 4 likes
  • 4 in conversation