07-03-2015 09:58 AM
I've just started using SAS and am trying to figure out how to compare prevalence rates across years and see average percent change (95% CI).
For example, if allergy rates to Allergen A are:
2012 - 2.5%
What is the best way to determine the average percent change per annum?
Also, if allergy rates to Allergen B are:
Is there a way to determine if there is a significant difference between rates for allergen A and B for the same year?
Thank you so much!
07-03-2015 12:20 PM
Do you have the raw data that creates those proportions? If you don't have the N's then it's difficult to
If so you can consider using the Cochran Armitage test via proc freq:
EDIT: I think I misunderstood your question, but my question still stands - do you have the raw data?
07-03-2015 01:28 PM
Here is a solution for the first part. If there is more than one record per year you would add group by year at the end. In this solution it's the average of every year.
input year rate;
lrate = lag(rate);
diff_rate = rate-lrate;
create table part1 as
select *,avg(diff_rate) as avg
07-03-2015 01:36 PM
If all you want is the difference between the two averages this will get you there. I'm guessing more information is valuable you can tweak the code. Let me know if this helps:
input year ratea;
lratea = lag(ratea);
diff_ratea = ratea-lratea;
create table part1 as
select *,avg(diff_ratea) as avga
input year rateb;
lrateb = lag(rateb);
diff_rateb = rateb-lrateb;
create table prep_diff as
select *,avg(diff_rateb) as avgb
create table want as
select distinct a.avga-b.avgb as avg_diff
from part1 a inner join
prep_diff b on
07-03-2015 03:46 PM
Thank you! This got me the average difference between each year exactly like I asked. Is there any way to determine if the rates for allergen A, for example, are statistically significantly different between years? (e.g. is 2.5% different from 5.9% with a 95% CI and p-value?)
In your code above, the output shows the average change between years (avga and avgb). Is there a way to see if these averages are statistically different from each other?
07-06-2015 09:42 AM
Are you referring to the P value or is there another value that is significant for your purposes? I'm not sure I"ll be able to help much more.
07-06-2015 09:52 AM
I'm referring to a p-value. The code that you provided gives me an annual avg percent change and I'm just looking to get a confidence interval for this change, if possible.
07-06-2015 02:02 PM
Since the OP has the original data, then they can do this. Any of the following could be adapted: FREQ (using Cochran-Armitage), MULTTEST (Cochran Armitage), CATMOD, GENMOD, GLIMMIX, LOGISTIC. Personally, I would probably use GENMOD or GLIMMIX with a binomial distribution. I would not fit year as a repeated measure, unless I had evidence that the same individuals were measured each year. This rules out GEE as a method (and procedure).