BookmarkSubscribeRSS Feed
Samryn
Calcite | Level 5

I am trying to get a list of nearest neighbors for a dataset using Proc Modeclus.  It appears to be working well, except there is a limit to the ID and neighbor value that I need to change.  It appears to be limited to 5 characters, and I need more than that.  Does anyone know a way to change this?

ods _all_ close;

proc modelus data=in1 dk=11 neighbor;

     var xpos ypos;

ods output test1;

run;

in1 has 861,075 observations, and the listing I get gives the nearest neighbor if the observation values are less than or equal to 99,999, but uses ***** for values larger than that. 

Thank you for your help.

4 REPLIES 4
art297
Opal | Level 21

Which output table is truncating the results?  It may be a column that simply needs to be assigned a wider format via proc template.

Samryn
Calcite | Level 5

That is a great idea, but I don't know where the 5 character limit is being defined.  I changed the template for Neighbor, and formatted the values to be 8 characters long, and so the format changed, but the length did not. 

art297
Opal | Level 21

I would have thought the default of 8 characters would have been applied::

OUTLENGTH=n
OUTL=n

specifies the length of those output variables that are not copied from the input data set but are created by PROC MODECLUS.

The OUTLENGTH= option applies only to the following variables that appear in all of the output data sets: _K_, _DK_, _CK_, _R_, _DR_, _CR_, _CASCAD_, _METHOD_, _NJOIN_, and _LOCAL_.

The minimum value is 2 or 3, depending on the operating system. The maximum value is 8. The default value is 8.

Samryn
Calcite | Level 5

Ok, I think I found the problem.  To define a length for the output, you have to define an ID variable.  I defined the length of the ID variable in the data step just to make sure.

data in1;

set in1;

idv=_n_;

ods _all_ close;

proc modelus data=in1 dk=11 neighbor;    

var xpos ypos;

id idv;

ods output test1;

run;

Thank you for your help Art.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 1449 views
  • 3 likes
  • 2 in conversation