SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
MABRINCH
Fluorite | Level 6

Hi

I would like to calculate the APC annual percentage change with 95% CI for the crude incidence of a disease in the period 2010 til 2019. Is it necessary to use joinpoint software? (which I have no clue on how to work with). 

 

I have following data 

 

   year      incidence rate

20103.86
20114.89
20124.91
20134.92
20145.96
20156.02
20166.67
20175.62
20186.04
20196.43
2 REPLIES 2
Sajid01
Meteorite | Level 14

Hello @MABRINCH 

The following code will perform what you need.

In the code IR =Incidence rate and per_ch =percentage change;

data test;
input @1 year @6 IR;
ch_ir=ir-lag(ir);
datalines;
2010 3.86
2011 4.89
2012 4.91
2013 4.92
2014 5.96
2015 6.02
2016 6.67
2017 5.62
2018 6.04
2019 6.43
;
run;
proc sql;
select sum(ir) into:sum_ir from test;
run;
data test2 (drop=ch_ir);
Retain Year IR per_ch;
format per_ch z5.2;
set test;
per_ch=ch_ir*100/&sum_ir;
run;

The output will be like this. 

Sajid01_0-1623846656371.png

Make necessary changes as you may need.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1920 views
  • 1 like
  • 3 in conversation