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!!
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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.