Amit Singh Parihar
Amit Singh Parihar

Reputation: 557

SAS: error 180-322 statement is not valid or it is used out of proper order? What am I doing wrong here?

Here's my non working code.

data _NULL_;
infile datalines;
input name $ class date mmddyy10. type $ quantity;
profit = quantity*1.5;
datalines;
Adriana 21 3/21/2000 MP 7
Nathan  14 3/21/2000 CD 19
Matthew 14 3/21/2000 CD 14
Claire  14 3/22/2000 CD 11
Caitlin 21 3/24/2000 CD 9
Ian     21 3/24/2000 MP 18
Chris   14 3/25/2000 CD 6
Anthony 21 3/25/2000 MP 13
Stephen 14 3/25/2000 CD 10
Erika   21 3/25/2000 MP 17
;
File '/folders/myfolders/sasuser.v94/Library/candysales.txt' Print;
Title;
PUT @5 'Candy sales report for ' name 'from classroom ' class 
  //@5 'Congratulations! You sold ' quantity ' boxes of candy'
   /@5 'and earned' profit dollar8.2 'for field trip.';
PUT _PAGE_;
RUN; 

I keep getting the error

error 180-322 statement is not valid or it is used out of proper order

I have tried changing the File statement's placement but I keep getting the same error. I am new to SAS and still learning, but I can't find a solution for this.

Any ideas?

Upvotes: 0

Views: 12203

Answers (1)

Quentin
Quentin

Reputation: 6378

I think the datalines and data need to be the end of the step. So suggest you move the file statement and put statements to before the datalines statement. And move the title statement to before the data step. Title statement are global statements.

Upvotes: 1

Related Questions