BookmarkSubscribeRSS Feed
mgrzyb
Quartz | Level 8

 

Hi.   

 

Happy new year!   I have done this before, but with a constraint of time, I just can't figure it out.  Hoping someone will help me. 

 

I have 2 data sets for a longitudinal database.  

 

The short one is a database with age, and basic information, including type of medicine. The variable for the short database that I want to merge with each visit in the visit database is called MEDTYPE. 

 

I need to check the differences in bloodpressure  by visits (1700 total visits) which is long SAS database form. 

 

I need to create a table like this:

 

                                        DrugA      DrugB    DrugC

1.drop in BP (mean and freq)

2. increase in BP (mean and freq)

3. another variable (ditto)

 

However, I don't have the drug type in the long database.  

 

How do I join these so I can create that table or something like it?

 

I thank you and sorry to bother  you!!

2 REPLIES 2
Reeza
Super User
Post sample data that reflects your situation. Make it up if you cannot post real data.
mgrzyb
Quartz | Level 8

Hi.  I figured it out!!!!  I just couldn't get back to this page!

 

Thanks.  

 

data short ;
set aung.initial_complete5 (keep= id new3medtype bmi dmyearsdur sexmg smoker
age_initial M_diff_bg);
proc print; var id new3medtype;
run;


data long;
set aung.longeachvisit5 (keep =id diff_bg diff_o_bgallv_lower diff_o_lt120_posthi);

proc print;
run;

/* Merging long and short */

proc sort data=short; by id; run;
proc sort data=long; by id; run;

data want;
merge short long;
by id;
proc print;
run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 481 views
  • 2 likes
  • 2 in conversation