This should be fairly simple.
Trying to create a new variable for two groups separately.
For group a:
if diagn =0 or 1, then comorb=0;
if diagn >=2 then comorb=1;
For group b:
if diagn =0 then comorb=0;
if diagn >=1 then comorb=1;
The syntax for group2 works fine.
Here is my syntax for group1:
data x;
set x;
if group='a' then do;
if diagn =0 or diagn=1 then comorb=0;
else if diagn >=2 then comorb=1;
end;
This syntax does not calculate the comorb variable at all.
Any ideas on what might be wrong and how to correct it?
Thank you!
You haven't posted neither the log nor sample of your imput,
so it is impossible to know what is the mistake.
Is there a variable named GROUP in your input dataset ?
Please post the whole log of your data step.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.