- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hello,
I have little SAS experience and has been a challenge doing some data cleaning on my dataset. I have a dataset with 6 years worth of patient healthcare claims (2017-2022). Patients appear multiple times within each year and also reappear in subsequent years. What I want to do is eliminate the duplicates within the year. I was hoping to receive some pointers from this community.
My dataset contains "admit_date" for when they were admitted to receive medical care and "encounter" (character variable) for the type of level of medical urgency (emergency, outpatient or inpatient). however, say patient 01 was admitted 2 or more times within a week/month as an (outpatient encounter).
I would like to remove duplicates based on urgency level first so that I can then be able to narrow down to at least one "encounter" for every 30 day intervals. Below is a code I tried with the help of a colleague but keep getting an error, mind you this is using SQL but if I can get it done without using SQL that would be great. Thanks in advance.
currently using SAS 9.4
proc sql;
create table SSTIs_w_o_Dupadmitdate as
select DISTINCT (admit_date)
from research.Sstis
order by mrn where Encounter not= "Outpatient";
quit;
I get the error below
37 proc sql;
38 create table SSTIs_w_o_Dupadmitdate as
39 select DISTINCT (admit_date)
40 from research.Sstis
41 order by mrn where Encounter not= "Outpatient";
-----
22
202
ERROR 22-322: Syntax error, expecting one of the following: ;, !, !!, &, (, *, **, +, ',', -, '.',
/, <, <=, <>, =, >, >=, ?, AND, ASC, ASCENDING, BETWEEN, CONTAINS, DESC, DESCENDING,
EQ, EQT, GE, GET, GT, GTT, IN, IS, LE, LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR,
^, ^=, |, ||, ~, ~=.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"order by" must be placed after "where", valid symbols for "not equals" are ne, ^= and some more i can't remember right now.