BookmarkSubscribeRSS Feed
EGAah
Calcite | Level 5

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
HarrySnart
SAS Employee

Hi @EGAah 

 

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

 

Running the below loaded your sample data

 

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
         ;
EGAah
Calcite | Level 5
Thanks! The 'x' 'z' and 'w' were meant to represent numbers.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 451 views
  • 0 likes
  • 2 in conversation