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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: