BookmarkSubscribeRSS Feed
ThaoLinh
Calcite | Level 5

I encountered a rather odd issue when using PROC HPBIN that I’d like to share.

First, I used PROC HPBIN to perform binning on a dataset TEMP01and saved the resulting binning information into a mapping table (TEMP_MAPPING)

 

DATA TEMP01;
	LENGTH ID 8;

	DO ID=1 TO 1000;
		X1 = RANUNI(101);
		X2 = 10*RANUNI(201);
		X3 = 100*RANUNI(301);
		OUTPUT;
	END;
RUN;

PROC HPBIN DATA=TEMP01 OUTPUT=BIN_TEMP01 NUMBIN=10 BUCKET;
	INPUT X1-X3;
	ODS OUTPUT MAPPING=TEMP_MAPPING;
RUN;

 

This part worked as expected.

ThaoLinh_0-1748005807328.png

 

However, when I tried to apply the same binning to a different dataset (TEMP02) using the saved mapping, the process failed — but only when the variable order in the new dataset was different from the original

 

 

PROC SQL NOPRINT;
	CREATE TABLE TEMP02 AS SELECT X3, X2, X1 FROM TEMP01;
QUIT;

PROC HPBIN DATA=TEMP02 BINS_META=TEMP_MAPPING OUTPUT=BIN_TEMP02 NUMBIN=10 BUCKET;
	INPUT X1-X3;
RUN;

The result:

 

ThaoLinh_1-1748005870460.png

It also makes the issue very difficult to detect and debug. I believe this behavior should be addressed, or at the very least clearly documented, as it can lead to significant confusion and incorrect processing.

1 REPLY 1
SASKiwi
PROC Star

If you want an official response to your issue then raising a Tech Support track is the best option.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 574 views
  • 1 like
  • 2 in conversation