BookmarkSubscribeRSS Feed
Ballswool
Calcite | Level 5

Hi,

    Am having trouble getting each row in one data set to compare/join with all the rows in a second data set,

as in the attached file. Have tried many many variations but still cannot get the desired result.

Running SAS 9.1.3 Service Pack 4 in Redhat Linux.

Thanks in advance.

Regards,

             Allan.

3 REPLIES 3
art297
Opal | Level 21

Since all you appear to want is the cartesian product of the two files, I would think that using proc sql would be the easiest way to get it.  E.g.,

proc sql;

  create table want as

    select *

      from file1,file2

  ;

quit;

Ballswool
Calcite | Level 5

art,

      Thanks for the reply, I can see how it would be possible with sql, though a bit complex.

Would still prefer to be able to compare each row of file1 with every row on file2.

The data would be from a survey on a 50 x 50 meter grid where file1 would contain two numerical

values x1 y1 where one unit represents 50m with the origin at say  0 0.

file2 would contain a grid  x2 y2 with an origin of 25 by 25.

Rows in file1 represent points that cannot be accessed and need to be moved by a maximum radius

to a point on the second grid such that points from file1 will be allocated to points in file2 only once

and points in file2 will only be matched with a point from file1 once.

Both files could be in the thousands.

Regards,

             Allan.

Tom
Super User Tom
Super User

You can make a dataset solution that does a cartesian product.

data want ;

   set one;

   do _p=1 to _nobs;

     set two point=_p nobs=_nobs;

     output;

   end;

run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 688 views
  • 3 likes
  • 3 in conversation