BookmarkSubscribeRSS Feed
AprilR
Calcite | Level 5

Hello All-

I am trying to write a new variable in a data set. From my research it says I need to use the 'data' command and 'set' but I am getting an error. My current data set is called middata.her and I am trying to make a new variable named ICENTERED that calculates the deviation of a variable from the sample mean. Here is my code:

 

libname middata '/folders/myfolders/';
data ICENTERED
set middata.HER;
run;

 

Here is the error

ERROR 56-185: SET is not allowed in the DATA statement when option DATASTMTCHK=COREKEYWORDS. Check for a missing semicolon in the
DATA statement, or use DATASTMTCHK=NONE.
 
I am not sure what that error means because every tutorial says to use "Set"
3 REPLIES 3
SASKiwi
PROC Star

You are missing a semicolon:

libname middata '/folders/myfolders/';
data ICENTERED; * <=== here;
set middata.HER;
run;

 

Reeza
Super User

Someone else has provided the answer, but I wanted to point out the SAS tutorial video's which cover these types of topics. 

 

This specific one covers new variables:

https://video.sas.com/detail/videos/sas-analytics-u/video/4573023399001/creating-a-new-column-in-sas...

 

The general ones are here:

https://video.sas.com/category/videos/sas-analytics-u#category/videos/sas-analytics-u/0

 


@AprilR wrote:

Hello All-

I am trying to write a new variable in a data set. From my research it says I need to use the 'data' command and 'set' but I am getting an error. My current data set is called middata.her and I am trying to make a new variable named ICENTERED that calculates the deviation of a variable from the sample mean. Here is my code:

 

libname middata '/folders/myfolders/';
data ICENTERED
set middata.HER;
run;

 

Here is the error

ERROR 56-185: SET is not allowed in the DATA statement when option DATASTMTCHK=COREKEYWORDS. Check for a missing semicolon in the
DATA statement, or use DATASTMTCHK=NONE.
 
I am not sure what that error means because every tutorial says to use "Set"

 

Kurt_Bremser
Super User

The answer is RIGHT THERE BEFORE YOUR EYES:

Check for a missing semicolon in the DATA statement

That is one of the best and most comprehensive ERROR messages I have ever seen in SAS, and it shows the exact cause.