Home > Enterprise >  SAS Variable is reading too many levels when inputting data
SAS Variable is reading too many levels when inputting data

Time:10-03

The following is my code:

/* Enter Data */
data leaf;
    input Delay Angle @@;
    cards;
    30 140  30 138  30 140  30 138  30 142
    45 140  45 150  45 120  45 128  45 130
    60 118  60 130  60 128  60 118  60 118
;
run;

/* Comparing All Delays */
proc glm data=leaf plots=diagnostics;
    class Delay;
    model Angle = Delay;
    means Delay / HOVtest=Levene;
    title "Comparison of All Delays";
run;

When I run the code, I receive the following:

enter image description here

My issue is that the Delay variable should only have 3 levels with values of 30 45 60 but as you can see, it is reading in more levels than it should. To me, the data looks perfectly fine and I have no idea why it's not reading correctly. Any and all help is greatly appreciated!

CodePudding user response:

Your data step produces only three different values for delay when copied and pasted into SAS Display Manager editor window.

Perhaps there is some non space character hiding in that "white" space that is causing the INPUT statement to get out of sync.

But why did you indent the CARDS statement and the lines of in-line data? Try formatting your code like this to reduce the risk of doing that.

data leaf;
  input Delay Angle @@;
cards;
30 140  30 138  30 140  30 138  30 142
45 140  45 150  45 120  45 128  45 130
60 118  60 130  60 128  60 118  60 118
;

Also make sure to use a period to indicate any missing values.

  • Related