Vincent
Vincent

Reputation: 955

using two datasets without merging them

I'm new to SAS and more used to R programming and I can't find how to do something quite simple in R : using values stocked in two different datasets in one calculation.

Let's say I have two datasets :

In R, I could go for something like calculation(Mydata[,1],coefs[1,]) to get an outcome with n rows and 1 column. However, I can't find how to proceed with SAS, given that I can't merge these tables which have not the same dimensions neither any common variable.

I tried things like :

DATA outTable;
Set Mydata coefs;
/* calculation */
run;

or :

DATA outTable;
Set Mydata;
Set coefs;
/* calculation */
run;

but I never get the n-rows outcome I want due to dimension incompatibility.

How should I proceed ?

Upvotes: 1

Views: 137

Answers (1)

Longfish
Longfish

Reputation: 7602

Try this.

DATA outTable;
Set Mydata;
if _n_=1 then Set coefs;
/* calculation */
run;

Coefs is read in only once, then the values are retained for each row of Mydata.

Upvotes: 2

Related Questions