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?

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

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?

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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