BookmarkSubscribeRSS Feed
RajasekharReddy
Fluorite | Level 6

hi ,

can any one tell me how we will write below SQL code in data step by using merge

  PROC SQL;

      CREATE TABLE merge AS

      SELECT A.PATIENT,A.DATE , A.PULSE,

      B.PATIENT, B.DOSES, B.AMT  FROM VITALS as A , DOSING as B

      where A.PATIENT=B.PATIENT and B.AMT ne " ";

  quit;

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

data want;

     merge vitals (in=a) dosing (in=b where=(amt ne ""));

     by ...;

     if a and b then output;

run;

RajasekharReddy
Fluorite | Level 6

thanks for providing code for same however small change in code and tell me how we can aply condtion in both data sets as

data want;

     merge vitals (in=a where=(

A.pulse eq 'y') dosing (in=b where=(amt ne ""));

by ...;

     if a and b then output;

run;

 

PROC SQL;

  CREATE TABLE merge AS

  SELECT A.PATIENT,A.DATE , A.PULSE,

  B.PATIENT, B.DOSES, B.AMT  FROM VITALS as A , DOSING as B

  where A.PATIENT=B.PATIENT and A.pulse eq 'Y' and B.AMT ne " ";

  quit;

Loko
Barite | Level 11

helo,

/*prepare some data*/

data classwork;
set sashelp.class(where=(sex="M"));
if mod(_N_,2)=0 then call missing(height);
run;

/*output*/
data want;
merge sashelp.class (in=a) classwork (in=b);
by name;
if a and b and height ne .;
run;

husseinmazaar
Quartz | Level 8

data want;

     merge vitals (in=a) dosing (in=b);

     by PATIENT;

     if a and b;

where amt ne ' ';

run;

thanks

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!

How to choose a machine learning algorithm

Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1003 views
  • 0 likes
  • 4 in conversation