Help using Base SAS procedures

ERROR: Variable event in list does not match type prescribed for this list.

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

ERROR: Variable event in list does not match type prescribed for this list.

I'm receiving an error pertaining to variables that I thought I had covered. I am a novice at writing SAS and would appreciate any help I can get. Here is the code that I wrote and the associated error message. Thanks in advance for your help!!!

data rats;

length treatment $ 8;

input time event $treatment;

datalines;

18    1    Group0        23    1    Group0

25    1    Group0        26    1    Group0

29    0    Group0        30    1    Group0

30    1    Group0        31    1    Group0

31    0    Group0        32    0    Group0

13    1    Group1        13    1    Group1

15    1    Group1        17    1    Group1

17    0    Group1        18    1    Group1

18    1    Group1        21    1    Group1

23    1    Group1        23    0    Group1

24     1    Group1        25    1    Group1

25    1    Group1

;

ods graphics on;

proc lifetest data=rats atrisk conftype=asinsqrt

    plots=(survival(cb=ep atrisk) loglogs logsurv);

    time time*event(0);

    strata treatment;

run;

ods graphics off;

42     ods graphics on;
43     proc lifetest data=rats atrisk conftype=asinsqrt
44    plots=(survival(cb=ep atrisk) loglogs logsurv);
45    time time*event(0);

ERROR: Variable event in list does not match type prescribed for this list.

46    strata treatment;
47     run;

Thanks again,

Nathan


Accepted Solutions
Solution
‎03-15-2015 08:51 PM
Contributor dkb
Contributor
Posts: 53

Re: ERROR: Variable event in list does not match type prescribed for this list.

Posted in reply to nbauer1201

On an list-style input statement, it says that the preceding variable is a character variable.


But since SAS already knows that treatment is a character variable - you've told it in the previous line...

length treatment $ 8;

... you don't need to use $ at all in your input statement.  This will work fine:


data rats;

length treatment $ 8;

input time event treatment;

datalines;

18    1    Group0

...



View solution in original post


All Replies
Contributor dkb
Contributor
Posts: 53

Re: ERROR: Variable event in list does not match type prescribed for this list.

Posted in reply to nbauer1201

What do you think the $ does in this line?

input time event $treatment;

New Contributor
Posts: 3

Re: ERROR: Variable event in list does not match type prescribed for this list.

Doesn't the $ tell sas that it is a character value?

Solution
‎03-15-2015 08:51 PM
Contributor dkb
Contributor
Posts: 53

Re: ERROR: Variable event in list does not match type prescribed for this list.

Posted in reply to nbauer1201

On an list-style input statement, it says that the preceding variable is a character variable.


But since SAS already knows that treatment is a character variable - you've told it in the previous line...

length treatment $ 8;

... you don't need to use $ at all in your input statement.  This will work fine:


data rats;

length treatment $ 8;

input time event treatment;

datalines;

18    1    Group0

...



New Contributor
Posts: 3

Re: ERROR: Variable event in list does not match type prescribed for this list.

I can't thank you enough! That absolutely fixed it!!!! It ran with no problems. I was clearly being redundant.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 1149 views
  • 0 likes
  • 2 in conversation