BookmarkSubscribeRSS Feed
Rou
Obsidian | Level 7 Rou
Obsidian | Level 7

Hi all,

 

I am trying to create a new variable for patients who received neither treatment in my data. In total, 385 patients did not receive any drug.

Here is a sample code(it is wrong), and I need help. Thank you!

/*Creating a new variable for nontreatment*/
Data new;
set have;
if advil_dose= 0 then notreatment= 1 and if motrin_dose= 0 then notreatment= 2;
run;

3 REPLIES 3
Rou
Obsidian | Level 7 Rou
Obsidian | Level 7

Thanks for your response, Kurt. I am not looking for a count of the no-drug subgroup instead, I want to create a new variable called notreatment.

If advil_dose = 0 then notreatment = 1 and if motrin_dose = 0 then no treatment= 2. I am not sure how to do this correctly in SAS. 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 798 views
  • 0 likes
  • 2 in conversation