BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
rjinks
Obsidian | Level 7

My observation number is being limited by an error. The code and results are below. I have back tracked the lines mention but I have been unsuccessful in finding the flaw in the code.

 

Data SsamPAHan;
Input Site $ Ace Anthra Benzoaa Benzoapy
Benzobflu Benzoghi Benzokfluo Chry
Dibenzo Fluoran Fluorene Indeno123
Phen Pyr;
Datalines;
LC 0 0 0.024266667 0.015533333 0.02602 0.008633333 0.010333333 0.0172333330 0.006366667 0.041333333 0.016933333 0.023333333 0.053833333
SK1 0.004966667 0.004966667 0.0078 0.005666667 0.008533333 0 0 0.0078 0 0 0.003566667 0.003566667 0.008593333 0.027133333
WR1 0.0042 0.0077 0.04 0.0175 0.02539 0.0063 0.0091 0.0224 0 0 0 0.0091 0.018216667 0.093156667
WR2 0 0 0.00595 0.00595 0.011833333 0.0042 0.00345 0.005326667 0.002176667 0 0 0.003733333 0.006066667 0.013743333
PI 0 0 0 0 0 0 0 0 0 0 0 0 0.006003333 0;
Proc Univariate Normaltest;
run;

 

Log Comments below:

 

83 PI 0 0 0 0 0 0 0 0 0 0 0 0 0.006003333 0;
__
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

84 Proc Univariate Normaltest;
85 run;

NOTE: PROCEDURE UNIVARIATE used (Total process time):

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Datalines requires that the block end with a semicolon, or 4 semicolons if using datalines4, as the only character

your last of data values should NOT have the semicolon.

 

Paste code, especially involving datalines, and log entries on the forum into a code box opened with the </> icon. Otherwise the message window will reformat the text and likely have something other that your actual code/ datalines values.

This code:

data wrong;
  input x y;
datalines;
1 2
3 4;

generates this log:

158  data wrong;
159    input x y;
160  datalines;

NOTE: The data set WORK.WRONG has 1 observations and 2
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


162  3 4;
     -
     180

ERROR 180-322: Statement is not valid or it is used out of
               proper order.

This doesn't:

data right;
  input x y;
datalines;
1 2
3 4
;
164  data right;
165    input x y;
166  datalines;

NOTE: The data set WORK.RIGHT has 2 observations and 2
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


169  ;

other common problems with datalines comes from not starting data on the left boundary, blank lines and attempting to use stuff copied from non-plain text sources that can have not shown characters that affect the program (copying from websites where HTML characters are embedded or word processing documents for example )

 

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

Can you please show us the log by preserving the formatting that exists? You do this by copying the log as text and pasting it into the window that appears when you click on the </> icon. This makes everything easier to read.

 

Also, please show us the entire log for this DATA step, not selected portions of the log. We need to see the code in the log, the NOTEs, ERRORs and WARNINGs, with nothing edited or chopped out.

--
Paige Miller
rjinks
Obsidian | Level 7

Thank you for the suggestions.

RichardDeVen
Barite | Level 11

Your last data line has a terminating semi-colon. 

Move the semi-colon to be on the next source code line by itself.

 

Data SsamPAHan;
Input Site $ Ace Anthra Benzoaa Benzoapy
Benzobflu Benzoghi Benzokfluo Chry
Dibenzo Fluoran Fluorene Indeno123
Phen Pyr;
Datalines;
LC 0 0 0.024266667 0.015533333 0.02602 0.008633333 0.010333333 0.0172333330 0.006366667 0.041333333 0.016933333 0.023333333 0.053833333
SK1 0.004966667 0.004966667 0.0078 0.005666667 0.008533333 0 0 0.0078 0 0 0.003566667 0.003566667 0.008593333 0.027133333
WR1 0.0042 0.0077 0.04 0.0175 0.02539 0.0063 0.0091 0.0224 0 0 0 0.0091 0.018216667 0.093156667
WR2 0 0 0.00595 0.00595 0.011833333 0.0042 0.00345 0.005326667 0.002176667 0 0 0.003733333 0.006066667 0.013743333
PI 0 0 0 0 0 0 0 0 0 0 0 0 0.006003333 0;   <----------------- PLACEMENT OF SEMICOLON IS WRONG

Last line should be

PI 0 0 0 0 0 0 0 0 0 0 0 0 0.006003333 0
;

If your actual data is as posted then some of the data lines are incomplete with regard to INPUT.  You might want to add

 

infile cards missover;

 

to the DATA Step

 

rjinks
Obsidian | Level 7
Thank you I obtained the results.
Kurt_Bremser
Super User

Your first dataline has only 13 numeric values, but your code tries to read 14. Use

infile datalines truncover;

as your first data step statement to prevent the skip to the next line.

Also move the semicolon that ends the DATALINES block to its own line.

rjinks
Obsidian | Level 7

Thank you. I obtained the results.

ballardw
Super User

Datalines requires that the block end with a semicolon, or 4 semicolons if using datalines4, as the only character

your last of data values should NOT have the semicolon.

 

Paste code, especially involving datalines, and log entries on the forum into a code box opened with the </> icon. Otherwise the message window will reformat the text and likely have something other that your actual code/ datalines values.

This code:

data wrong;
  input x y;
datalines;
1 2
3 4;

generates this log:

158  data wrong;
159    input x y;
160  datalines;

NOTE: The data set WORK.WRONG has 1 observations and 2
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


162  3 4;
     -
     180

ERROR 180-322: Statement is not valid or it is used out of
               proper order.

This doesn't:

data right;
  input x y;
datalines;
1 2
3 4
;
164  data right;
165    input x y;
166  datalines;

NOTE: The data set WORK.RIGHT has 2 observations and 2
      variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


169  ;

other common problems with datalines comes from not starting data on the left boundary, blank lines and attempting to use stuff copied from non-plain text sources that can have not shown characters that affect the program (copying from websites where HTML characters are embedded or word processing documents for example )

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1006 views
  • 2 likes
  • 5 in conversation