BookmarkSubscribeRSS Feed
ManitobaMoose
Quartz | Level 8

Hi,

 

I am brand new to SAS and am learning from the book Learning SAS from example. Problem 5.3, there are answers, and I have copied them, with the only difference that I am using the SAS University Edition on Vbox, a UNIX based system, not windows. I am extremely frustrated because I am getting the 180-322 error after the datalines and everthing seems just fine to me, after lots and lots of looking at it. Maybe someone can let me know what the problem is? Thanks!

Below is the code:

--------------------------------

 

Libname Myfold '/folders/myfolders/sasuser.v94/Perm/MyFold' ; 

Data myfold.colors ;
input Color : $1. @@ ;
datalines ;
R R B G Y Y . . B G R B G Y P O O V V B ;


proc format ;
value $color 'R' , 'B' , 'G' = 'Group1'
'Y' , 'O' = 'Group2'
' ' = 'Not Given'
Other = 'Group3' ;
run ;

Title "Colors Frequencies (Grouped)" ;
proc freq data=myfold.colors ;
Tables Color / nocum missing ;
format color $color. ;
run ;

 

6 REPLIES 6
novinosrin
Tourmaline | Level 20


Data colors ;
input Color : $1. @@ ;
datalines ;
R R B G Y Y . . B G R B G Y P O O V V B
;/*notice here*/

 

what's the problem

novinosrin
Tourmaline | Level 20

Oh right, just the placement of the ; should have been after the last dataline in the next line

ManitobaMoose
Quartz | Level 8

Great! Thanks. I didn;t know the semicolon HAD to be on the next line. I thought that was optional.

novinosrin
Tourmaline | Level 20
You are welcome. ; is basically known as a null statement. It's very interesting statement and has some relevance as it is an executable statement. In some instances, you can even use that for conditional processing however that is out of scope for this thread. Have fun!
MarkWik
Quartz | Level 8

@ManitobaMoose I think it's pretty simple. Mark the question as answered.

Kurt_Bremser
Super User

@ManitobaMoose wrote:

Great! Thanks. I didn;t know the semicolon HAD to be on the next line. I thought that was optional.


When using datalines; or cards;, a single semicolon in a line will be recognized as the end of the datalines section (and, by defintion, the end of the data step). If something else comes before that semicolon in that line, it is treated as the first statement fo the next step. Since your line does not contain valid SAS code, it causes the error.

If you need to have semicolons in your datalines, use the datalines4; statement. Then 4 successive semicolons are needed to end the datalines section.

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
  • 6 replies
  • 1666 views
  • 4 likes
  • 4 in conversation