Calcite | Level 5

## Proc GENMOD, datalines, and how to import error margins

Hello,

I'm trying to input data into SAS to perform a proc genmod procedure however am unsure from the documentation how to best adjust for the error in the estimates when importing the data in a datalines step.

e.g.. here is an example of the syntax I am trying to use;

data ins;

input n c v;

ln = log(n);

datalines;

1715 59  1

2784 77  2

2486 72  3

;

proc genmod data=ins;

class v;

model c = v / dist=poisson link=log offset=ln;

estimate "v Rate Ratio" v 1 0 -1;

estimate "v Rate Ratio" v 1 -1 0;

run;

and here is what I am trying to do with the SAS code; (essentially adjust for the error [e.g. for 95% confidence interval] margins around ‘n’ but I am not sure about the syntax for the datalines step nor for the proc genmod:

data ins; /*method for incorporating upper/lower error bounds around n?*/

input n uppern lowern c v;

ln = log(n);

datalines;

1715 x  x  59  1

2784 z  z  77  2

2486 w  w  72  3

;

?

proc genmod=???

My question is about how to import these data into SAS with the datalines step and then run the analysis with the genmod procedure accounting for the error in the n estimates.

Can you please help me with the best way to 1) import the code with error margins around ‘n’, and 2) then run the proc genmod adjusting for the ‘nupper’ and ‘nlower’?

Thanks so much!

2 REPLIES 2
SAS Employee

## Re: Proc GENMOD, datalines, and how to import error margins

Hi @EGAah

Your second datalines included character variables. You need to add a \$ in the input statement for character variables.

``````data ins; /*method for incorporating upper/lower error bounds around n?*/
input n uppern \$ lowern \$ c v;
ln = log(n);
datalines;
1715 x  x  59  1
2784 z  z  77  2
2486 w  w  72  3
;``````
Calcite | Level 5

## Re: Proc GENMOD, datalines, and how to import error margins

Thanks! The 'x' 'z' and 'w' were meant to represent numbers.
Discussion stats
• 2 replies
• 432 views
• 0 likes
• 2 in conversation