Creating dataset from multiple datasets

Reply
Occasional Contributor
Posts: 8

Creating dataset from multiple datasets

Hi..  i have a query on how to create a new dataset from 3 different existing datasets by taking values from existing dataset1 then multiply the obs with dataset2 then divide the same obs with dataset3. The data in all 3 existing datasets have same variable names.

Thanks

Parwaiz

Super User
Super User
Posts: 7,401

Re: Creating dataset from multiple datasets

Hi,

Best to provide actual data examples, but my interpretation is something like (you need a linking variable):

proc sql;

  create table WANT as

  select  COALESCE(A.COMMON_VAR,B.COMMON_VAR,C.COMMON_VAR) as COMMON_VAR,

          (A.VAL * B.VAL) / C.VAL as RESULT

  from    DATASET1 A

  full join DATASET2 B

  on      A.COMMON_VAR=B.COMMON_VAR

  full join DATASET3 C

  on      A.COMMON_VAR=C.COMMON_VAR;

quit;

Frequent Contributor
Posts: 106

Re: Creating dataset from multiple datasets

hard to understnd the requirement, Its always easier to understand a problem if inputs and desired output data examples are provided.

Ask a Question
Discussion stats
  • 2 replies
  • 154 views
  • 0 likes
  • 3 in conversation