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

Hello,

 

I've been doing a lot of searching for this problem and can't seem to figure it out. I don't think the problem is my code because my code works properly in SAS Studio, but I have a huge dataset so I prefer to use SAS locally on my desktop.

 

Very simple code can give you an idea of the problem:

 

data test2;

set test;

year=year(date);

run;

 

The above runs perfectly fine in SAS Studio, but in my local version of SAS, "year(  )" isn't recognized as a function and doesn't change color. 

 

Is there a quick fix to this and a novice like me has just overlooked the issue?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Not changing colour doesn't mean its not recognized. The IDE aka Base SAS is ancient and not being developed further as they concentrate on EG and Studio. Does the code work or does it generate an error? That's the test. If it generates an error, post your log from the local code/SAS Studio AND your log from the system that generates the error. 

 


@CJRPHD wrote:

Hello,

 

I've been doing a lot of searching for this problem and can't seem to figure it out. I don't think the problem is my code because my code works properly in SAS Studio, but I have a huge dataset so I prefer to use SAS locally on my desktop.

 

Very simple code can give you an idea of the problem:

 

data test2;

set test;

year=year(date);

run;

 

The above runs perfectly fine in SAS Studio, but in my local version of SAS, "year(  )" isn't recognized as a function and doesn't change color. 

 

Is there a quick fix to this and a novice like me has just overlooked the issue?

 

Thanks!


 

View solution in original post

3 REPLIES 3
ChrisHemedinger
Community Manager
year() is a function in Base SAS, regardless of environment where you run. If you're seeing a coloring and syntax error, check that you have semicolons in place!
Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!
Reeza
Super User

Not changing colour doesn't mean its not recognized. The IDE aka Base SAS is ancient and not being developed further as they concentrate on EG and Studio. Does the code work or does it generate an error? That's the test. If it generates an error, post your log from the local code/SAS Studio AND your log from the system that generates the error. 

 


@CJRPHD wrote:

Hello,

 

I've been doing a lot of searching for this problem and can't seem to figure it out. I don't think the problem is my code because my code works properly in SAS Studio, but I have a huge dataset so I prefer to use SAS locally on my desktop.

 

Very simple code can give you an idea of the problem:

 

data test2;

set test;

year=year(date);

run;

 

The above runs perfectly fine in SAS Studio, but in my local version of SAS, "year(  )" isn't recognized as a function and doesn't change color. 

 

Is there a quick fix to this and a novice like me has just overlooked the issue?

 

Thanks!


 

CJRPHD
Calcite | Level 5
Sometimes a message sparks an idea. I closed down SAS, re-ran my code and now it works. Turns out I was printing the wrong dataset (so it was my code after all!). Thanks for your help!

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1030 views
  • 0 likes
  • 3 in conversation