- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am Base SAS Student.
I'm trying to do a Combining Various Boolean Operators but I was get some error to execute this below code. First I had making New Database then I tried to combine data with using Boolean Logic.
I tried using this code but it didn’t work
As an example, the data set Medical contains information on clinic, diagnosis (DX), and weight. A program to list all patients who were seen at the HMC clinic and had either a diagnosis 7 or 9 or weighted over 180 pounds demonstrates how to combine various Boolean operators:
Data Learning_From_Medical;
Length Id $ 3
VisitDate $ 10;
Input Id Clinic $ DX Weight VisitDate;
Cards;
001 HMX 18 220 05/08/2006
003 TDX 8 265 02/06/2006
005 HTX 20 285 04/04/2006
004 HMC 9 185 25/07/2006
025 TFT 7 272 28/06/2006
032 HMX 12 160 18/02/2006
065 TDX 28 289 16/03/2006
072 HTX 32 255 12/09/2006
099 TFT 44 112 09/09/2006
050 HMC 88 198 12/12/2006
065 HTX 120 250 02/07/2006
002 HMC 7 162 20/11/2006
008 TDX 65 277 15/08/2006
012 HMC 12 222 14/04/2006
006 TFT 6 666 06/06/2006
;
RUN;
Title "Example of Boolan Expressions";
Proc print Data=learning_from_medical;
where Clinic eq 'HMC' and
(DX in ('7','9') or
Weight gt 180);
id ID;
var Clinic DX Weight VisitDate;
Run;
Can someone please give me the exact code to solve this error?
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
since DX is a numeric variable we need to use numeric values without the quotes
Proc print Data=learning_from_medical;
where Clinic eq 'HMC' and
(DX in (7,9) or
Weight gt 180);
id ID;
var Clinic DX Weight VisitDate;
Run;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
since DX is a numeric variable we need to use numeric values without the quotes
Proc print Data=learning_from_medical;
where Clinic eq 'HMC' and
(DX in (7,9) or
Weight gt 180);
id ID;
var Clinic DX Weight VisitDate;
Run;
Jag
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you so much! I have the output this time. Again, thank you for your time and your help.