Help using Base SAS procedures

Proc format with cntlin option

Reply
Super Contributor
Posts: 291

Proc format with cntlin option

I'm reading data from an xl file and then run it through the data step below in preparation for the proc format that follows it. Works the way it should.
The data that I apply this format to has values that are not in the start list. I'd like to group these into a category called 'Other'. I can add a label = 'Other' but I don't know how to 'wildcard' the start value. If you can help, please do. Thanks.

data CPL4DelCd;
set _4CPLDELAYCODES ;
fmtname='$CPL4Dly';
Label=AMDelayCd1||AMDelayCd2;
Start=Dly_Class_Cd||Dly_Type_Cd||Dly_Reason_Cd;

run;


proc format cntlin=CPL4DelCd;
run;
Super Contributor
Super Contributor
Posts: 3,174

Re: Proc format with cntlin option

A Google advanced search of the SAS support http://support.sas.com/ website yielded several matches, some SAS-hosted documentation and some technical papers on the topic. Here's the search argument - the site: parameter limits the search:

proc format cntlin other site:sas.com

Another discovery technique would be to create a simple format with PROC FORMAT and VALUE, coding an OTHER= , and then run PROC FORMAT with CNTLOUT= and use PROC PRINT to see the SAS-generated results.

You will want to explore using the HLO='O' variable value, leaving START as blank, and assigning some desired LABEL variable value -- this would be an extra observation.


Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 291

Re: Proc format with cntlin option

Thanks Scott. The HLO option does the trick. Shown below.

data CPL4DelCd end=last;
set _4CPLDELAYCODES ;
fmtname='$CPL4Dly';
Label=AMDelayCd1||AMDelayCd2;
Start=Dly_Class_Cd||Dly_Type_Cd||Dly_Reason_Cd;
output;

if last then do;
hlo='O'; /* upper case letter O */
label='Othr';
output;
end;

run; edit by Bill 14May2009 14:19 EDT

Message was edited by: Bill
Ask a Question
Discussion stats
  • 2 replies
  • 95 views
  • 0 likes
  • 2 in conversation