Statistical programming, matrix languages, and more

Error message "type is not in the scope of variables for the data set"

Reply
New Contributor
Posts: 3

Error message "type is not in the scope of variables for the data set"

Hi,

I am trying to run this code below, but I am getting an error message all the time that says:

"type is not in the scope of variables for the data set"

Please help! if you need the data set I can email it to you.

Please, please help!

Thank you,

Oldrainbow

Options ls=78;

Title "Turtle Carapace Analysis==2-Sample Hotellings Tsquare";run;

data turtle1;

  Infile "C:\HSRD8111\turtle.txt";

  Input length width height;

  run;

proc iml;

  start hotel2;

    n1=nrow(x1);

    n2=nrow(x2);

    k=ncol(x1);

    one1=j(n1,1,1);

    one2=j(n2,1,1);

    ident1=i(n1);

    ident2=i(n2);

    ybar1=x1`*one1/n1;

    s1=x1`*(ident1-one1*one1`/n1)*x1/(n1-1.0);

    print n1 ybar1;

    print s1;

    ybar2=x2`*one2/n2;

    s2=x2`*(ident2-one2*one2`/n2)*x2/(n2-1.0);

    print n2 ybar2;

    print s2;

    spool=((n1-1.0)*s1+(n2-1.0)*s2)/(n1+n2-2.0);

    print spool;

    t2=(ybar1-ybar2)`*inv(spool*(1/n1+1/n2))*(ybar1-ybar2);

    f=(n1+n2-k-1)*t2/k/(n1+n2-2);

    df1=k;

    df2=n1+n2-k-1;

    p=1-probf(f,df1,df2);

    print t2 f df1 df2 p;

  finish;

  use turtle1;

    read all var {length width height} where (type="female") into x1;

    read all var {length width height} where (type="male") into x2;

  run hotel2;

  quit;

Attachment
Esteemed Advisor
Posts: 6,877

Re: Error message "type is not in the scope of variables for the data set"

I think you will have more success at finding an answer if you move this post over to the iml forum.

New Contributor
Posts: 3

Re: Error message "type is not in the scope of variables for the data set"

I am totally new here.. I really appreciate your advice. I'll look for it.

Frequent Contributor
Posts: 122

Re: Error message "type is not in the scope of variables for the data set"

SAS is expecting to find a (character) variable in the turtle1 dataset called "type", however it only contains the three variables: length, width and height.  Try modifying the datastep to read the extra variable, along the lines of:

  Input length width height type : $6.;

New Contributor
Posts: 3

Re: Error message "type is not in the scope of variables for the data set"

Thanks, it worked!

Wonderful! I cant thank you enough!!

Thanks so much!!

Post a Question
Discussion Stats
  • 4 replies
  • 677 views
  • 3 likes
  • 3 in conversation