I've been trying to remove this blank/missing datum from the frequency results but have had no luck. Any advice?
I'm interested in seeing what comorbidities affect endometrial cancer survival.
I've been using the following code and got the output below:
DATA INPHAASE.COMORBIDOTH;
SET INPHAASE.COMORBIDITIES;
IF COMORBID = "Fibroids" THEN COMORBIDOTH = " ";
IF COMORBIDOTH = "." THEN COMORBIDOTH = " ";
RUN;
PROC FREQ DATA = INPHAASE.COMORBIDOTH;
TABLES COMORBID COMORBIDOTH;
RUN;
Comorbidities_other_reason | ||||
COMORBIDOTH | Frequency | Percent | Cumulative Frequency | Cumulative Percent |
1 | 0.18 | 1 | 0.18 | |
ABNORMAL LIVER TEST, HYPERLIPIDEMIA, GERD, ANXIETY DISORDER | 1 | 0.18 | 2 | 0.37 |
ADDISON'S DISEASE, MIGRAINE, HEADACHE, OSTEOARTHRITIS, DIVERTICULOSIS, DJD, SCIATICA | 1 | 0.18 | 3 | 0.55 |
ALLERGIC RHINITIS SINUSITIS | 1 | 0.18 | 4 | 0.73 |
ALLERGIC RHINITIS OSTEOARTHRITIS ASTHMA | 1 | 0.18 | 5 | 0.92 |
ALLERGIC RHINITIS HYPERLIPIDEMIA OVARIAN CANCER SECOND PRIMARY | 1 | 0.18 | 6 | 1.1 |
ALLERGIC RHINITIS LUNG CANCER | 1 | 0.18 | 7 | 1.28 |
ALLERY TO ASPIRIN AND MOTRIN | 1 | 0.18 | 8 | 1.47 |
ALS |
I'm not sure I see the relationship of your description to the code and to the outputs. I don't see how changing in the code some values to a text string of a single blank results in removing the "blank/missing datum from the frequency results", nor do I see how it helps in the resulting output table. So I'm lost.
Please explain further, with more detail, about what you have and what you want and what you don't want. Show us a portion of the input data. Show us the desired table.
You may have a different value than you expect, possibly from data entry or an earlier step.
I would also suggest using:
call missing(comorbidoth);
instead of the assignment of a blank.
To get rid of blanks from the table, add a WHERE statement in PROC FREQ:
PROC FREQ DATA = INPHAASE.COMORBIDOTH;
TABLES COMORBIDOTH;
where comorbidoth > ' ';
RUN;
If you want a similar table for COMORBID, run a second PROC FREQ. A single WHERE statement would affect all tables, and there is no guarantee that both COMORBID and COMORBIDOTH have missing values on exactly the same observations.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.