BookmarkSubscribeRSS Feed
qwerty12
Fluorite | Level 6

My format table contains start, end and label columns,

For Label - Not Prime the start and end vales are **OTHER**, the other labels are correctly populates where as Not Prime is not populated and output is getting impacted, how to over come this and get "Not Prime " instead below values

 

qwerty12_1-1693420536959.png

 

4 REPLIES 4
Tom
Super User Tom
Super User

It is not clear what you mean.

Did you define a custom format?  Did you do it by writing a VALUE statement?  Please show the value statement.

Did you do it by creating a CTLNIN dataset? Please show the dataset.  Does the dataset contain the HLO variable?

 

Show an example input dataset and how you want those values to print when using the format.

 

Please post code and data as text, not photographs.

PaigeMiller
Diamond | Level 26

Could you explain how the words you wrote relate to the data you show? I don't see a connection.

--
Paige Miller
ballardw
Super User

***OTHER*** for start/end values appear when the format was defined with an "OTHER =" statement, or setting the HLO variable to include 'O' in a  format cntlin data set indicating that any value not appearing in an explicit assignment range will be assigned the label. This is normal.

 

Showing a picture from a part of spreadsheet is not particularly helpful to diagnose something.

 

Where is the code that creates the format? That would help.

Or if you used a Cntlin data set with proc format then the values in that data set.

Then actual examples of the data. I am afraid that the picture you show sort of implies that the values of your data are likely to be character and ranges notoriously do not work well with character values because of the comparisons are conducted to result in equal/not equal.

 

 

FreelanceReinh
Jade | Level 19

Hello @qwerty12,

 

The key for the "other" category to work is that variable HLO='O'. If HLO is blank or not even contained in your CNTLIN dataset, the string "**OTHER**" in the START and END variables is treated like any other string. It has no special meaning. However, if HLO='O', the values of START and END are ignored for that observation, so you can leave them blank. The string "**OTHER**" for START and END will appear in FMTLIB output and a CNTLOUT dataset automatically. There is no need to type it.

 

Example:

data fmt;
retain fmtname '$testfmt';
input start $ label $ hlo $;
cards;
A one .
B two .
. any O
;

proc format cntlin=fmt;
run;

data _null_;
do c='A','B','X';
  put c $testfmt.;
end;
run;

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 253 views
  • 0 likes
  • 5 in conversation