DATA Step, Macro, Functions and more

Unintentional other range got created when using a dataset as input to proc format

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

Unintentional other range got created when using a dataset as input to proc format

Hi all

 

Could anybody tell me if the following behaviour is intended or not:

 

I created a format ($test2b) with the following dataset (created with datalines to simulate real data), with the expectation that the format will contain 2 values - 'other' and 'test'. Instead, the resulting format has only 1 value 'test' plus an other range (see image below)!  I could circumvent the issue by adding hlo=' '  to all records, just don't think this has been mentioned anywhere in the documentation.

 

data fmt1;

   infile datalines dlm=' ';

   length start label $32;

   input start label;

   fmtname='$test2b';

datalines;

other error

test ok

;

run;

 

proc format cntlin=fmt1;

run;

 

 otherrange.png

 

Thanks in advance.

 

V

 


Accepted Solutions
Solution
‎10-05-2017 06:15 AM
New Contributor
Posts: 3

Re: Unintentional other range got created when using a dataset as input to proc format

Posted in reply to Astounding

Got an official reply from SAS:

 

procformat.PNG

 

 

 

 

View solution in original post


All Replies
Super User
Posts: 7,846

Re: Unintentional other range got created when using a dataset as input to proc format

"other" is a keyword when creating formats. A pseudo-value of "other" covers all values not dealt with by the other entries.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
New Contributor
Posts: 3

Re: Unintentional other range got created when using a dataset as input to proc format

Posted in reply to KurtBremser

Hi KurtBremser

"other" is not a keyword, rather other (without quote) is, i.e. there would differences between the formats created by the following examples:

****Example 1****;

proc format;
value $test1a
'other'=error
'test'=OK;
run;

****Example 2****;

proc format;
value $test1a
other=error
test=OK;
run;

 

Since I have using a dataset without specifying HLO='O', so 'other' should be consider as a text string like in Example 1 above.

Super User
Posts: 5,516

Re: Unintentional other range got created when using a dataset as input to proc format

If you want more confidence that "other" won't be treated as a keyword, add this to your DATA step:

 

hlo=' ';

Solution
‎10-05-2017 06:15 AM
New Contributor
Posts: 3

Re: Unintentional other range got created when using a dataset as input to proc format

Posted in reply to Astounding

Got an official reply from SAS:

 

procformat.PNG

 

 

 

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 103 views
  • 4 likes
  • 3 in conversation