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 ;
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
Oh right, just the placement of the ; should have been after the last dataline in the next line
Great! Thanks. I didn;t know the semicolon HAD to be on the next line. I thought that was optional.
@ManitobaMoose I think it's pretty simple. Mark the question as answered.
@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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.