I have a freq table that showed my data set contained ages that should not be in my data set and I need to see who these folks are. I want to select everyone outside of a 2-13 age group and put those folks into a new table.
Is it a If statement, Keep?? I've tried this data step a few different ways, but keep getting an error.
data want;
set have;
If age_pdts= 2 <= Patage <= 13 then drop;
run;
Here is the freq table...
age_pdts | Frequency | Percent | Cumulative Frequency |
Cumulative Percent |
---|---|---|---|---|
1 | 3344 | 1.09 | 3344 | 1.09 |
2 | 20102 | 6.57 | 23446 | 7.66 |
3 | 24131 | 7.89 | 47577 | 15.55 |
4 | 28807 | 9.41 | 76384 | 24.96 |
5 | 34800 | 11.37 | 111184 | 36.33 |
6 | 35643 | 11.65 | 146827 | 47.98 |
7 | 31945 | 10.44 | 178772 | 58.42 |
8 | 29255 | 9.56 | 208027 | 67.98 |
9 | 25267 | 8.26 | 233294 | 76.24 |
10 | 22271 | 7.28 | 255565 | 83.52 |
11 | 19398 | 6.34 | 274963 | 89.86 |
12 | 16556 | 5.41 | 291519 | 95.27 |
13 | 12930 | 4.23 | 304449 | 99.49 |
14 | 1543 | 0.50 | 305992 | 100.00 |
28 | 7 | 0.00 | 305999 |
100.00 |
Always seems so easy when you do it!! lol
There's several ways to do this, here's another idea:
data good bad;
set have;
if 2 <= age_pdts <= 13 then output good;
else output bad;
run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.