My solution was to go with proc ginside.
However, I broke the 4 dimensional problem into a set of 10 2 dimensional problems.
I separated my limits data set into 10 data sets based on the 'temp' and 'cat' variables.
I also separated my operational data into 10 data sets also by 'temp' and 'cat' variables.
I then used proc ginside to determine which observations were inside and which were outside the limit polygon.
I then concatenated the 10 sets back to one.
Thanks for the advice.
The code is basic, but is here for benefit of readers. Feedback is welcome also.
/* Create the boundary tables */
data lim_35090 (keep=x y limid);
set sasuser.limits2330 (rename=(speed=x weight=y));
where(cat= 0.9 & temperature=35);
run;
data lim_35095 (keep=x y limid);
set sasuser.limits2330 (rename=(speed=x weight=y));
where(cat= 0.95 & temperature=35);
...8 others similar
/* Create tables of the operating data */
DATA ops_30090 ops_30095 ops_30100 ops_30105 ops_30110 ops_35090 ops_35095 ops_35100 ops_35105 ops_35110;
SET op_base1 (rename=(speed=x weight=y));
if temperature <= 30 then do;
if cat <= 0.90 THEN OUTPUT ops_30090;
else if (0.90 < cat <= 0.95) THEN OUTPUT ops_30095;
else if (0.95 < cat <= 1) THEN OUTPUT ops_30100;
else if (1 < cat <= 1.05) THEN OUTPUT ops_30105;
else OUTPUT ops_30110;
end;
else do;
if cat <= 0.90 THEN OUTPUT ops_35090;
else if (0.90 < cat <= 0.95) THEN OUTPUT ops_35095;
else if (0.95 < cat <= 1) THEN OUTPUT ops_35100;
else if (1 < cat <= 1.05) THEN OUTPUT ops_35105;
else OUTPUT ops_35110;
end;
RUN;
/* macro to evaluate if observation is inside limits*/
OPTIONS MPRINT;
%macro insout(suffix=);
proc ginside map=lim_&suffix data=ops_&suffix
out=results_&suffix
includeborder
;
id limid;
run;
%mend insout;
/* Run macros for ginside */
%insout(suffix=30090);
%insout(suffix=30095);
%insout(suffix=30100);
%insout(suffix=30105);
%insout(suffix=30110);
%insout(suffix=35090);
%insout(suffix=35095);
%insout(suffix=35100);
%insout(suffix=35105);
%insout(suffix=35110);
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.