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

I am using SAS Studio

 

variables are fertility and pcturban

 

I need to graph log(ferility)*pcturban, but SAS  is reading log as a variable, which I don't have.

 

proc plot data=UN112;
	plot log(fertility)*pcturban;
run;
proc reg data=UN112;
	model log(fertility)=pcturban;
run;

 Log function does not highlight blue in SAS Studio.

 

ERROR: Variable LOG not found.
NOTE: The previous statement has been deleted.
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, -, /, :, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_, {.
ERROR 200-322: The symbol is not recognized and will be ignored.

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Do you actually want the TEXT based result from using Proc Plot?

 

You would have to use a data step to calculate the log.

 

Or you might try

proc sgplot data=un112;
   scatter x=ferility y=pcturban;
   xaxis  type=log;
run;

Proc Reg also requires the transform done before hand not on a model statement.

 

Note that proc reg also supports plotting with the Plots= option.

 

Most of the time when you think something is a keyword and does not highlight in the editor you are either using it incorrectly or it is not  valid at all. Most of the time, there are some exceptions.

View solution in original post

1 REPLY 1
ballardw
Super User

Do you actually want the TEXT based result from using Proc Plot?

 

You would have to use a data step to calculate the log.

 

Or you might try

proc sgplot data=un112;
   scatter x=ferility y=pcturban;
   xaxis  type=log;
run;

Proc Reg also requires the transform done before hand not on a model statement.

 

Note that proc reg also supports plotting with the Plots= option.

 

Most of the time when you think something is a keyword and does not highlight in the editor you are either using it incorrectly or it is not  valid at all. Most of the time, there are some exceptions.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 764 views
  • 0 likes
  • 2 in conversation