BookmarkSubscribeRSS Feed
ArchanaSudhir
Obsidian | Level 7

Hi,

I need to combine the following 3 datasets based on parameters - treatment, x, y.

I thought of giving a sort oder for each dataset and using Union Corr. But not sure if it is the right way.

 

Data1

   

Grade1

 

treatment

x

     

sugar

ab

 

2

 
 bp  cd    3  
         
         

Data2

       

treatment

x

y

Grade1

 

sugar

ab

nausea

2

 

sugar

ab

headache

1

 

bp

cd

jaundice

3

 
         
         

Data3

       

treatment

x

y

z

Grade1

sugar

ab

nausea

vomit

2

sugar

ab

nausea

dizziness

4

sugar

ab

headache

tummy pain

1

bp

cd

jaundice

fever

1

bp

cd

jaundice

hig temp

3

         

Output:

       

treatment

x

y

z

Grade1

sugar

ab

   

2

sugar

ab

nausea

 

2

sugar

ab

nausea

vomit

2

sugar

ab

nausea

dizziness

4

sugar

ab

headache

1

sugar

ab

headache

tummy pain

1

bp

cd

   

3

bp

cd

jaundice

 

3

bp

cd

jaundice

fever

1

bp

cd

jaundice

hig temp

3

How do I achieve this?

Thanks,

Archana

 

1 REPLY 1
ballardw
Super User

How import is that exact order? If the idea is to group by treatment, x, y, z then

 

data want;

    set data1 data2 data3;

run;

 

proc sort data=want;

   by treatment x y Grade1 z;

run;

 

may get you close.

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 Concatenate Values

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.

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
  • 1 reply
  • 732 views
  • 2 likes
  • 2 in conversation