BookmarkSubscribeRSS Feed
khalillx
Fluorite | Level 6

Everything has worked well up until the point I tried to log my variable RINC. Then I get this error message: NOTE: Variable RINC is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
200 at 66:10
NOTE: There were 200 observations read from the data set WORK.PANELPROJ.
NOTE: The data set WORK.TWO has 200 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds

 

Here's my full code. I hit my pathway.

 

ibname session1 "C:\x";

PROC IMPORT OUT = panelproj
DATAFILE = "C:\x"
DBMS=csv REPLACE;
run;

proc contents;
run;
proc print;
run;
data one;
set panelproj;
if year = 2004 then cpi = 188.9;
if year = 2008 then cpi = 215.303;
if year = 2012 then cpi = 229.594;
if year = 2016 then cpi = 240.007;
RINC = INC/(CPI/100);
run;

proc contents;
run;

proc print;
run;

 

proc means;
class year;
var RINC UR educ VT;
run;

 

data two;
set panelproj;
logRINC= log(RINC);
run;

 

proc print;
run;

 

My code when I try to log my variable is not turning blue which makes me think I'm writing the code wrong. This is the way I did it in SAS studio but it may be different for SAS 9.4. 

6 REPLIES 6
PGStats
Opal | Level 21

RINC is defined in dataset one, not panelproj.

PG
Tom
Super User Tom
Super User

Not sure why your variables are turning blue.  Perhaps they need medication?

 

You cannot take the LOG() of a variable that doesn't exist.  You created RINC in the dataset ONE when you made it from PANELPROJ.  Why not just add this new variable to that step also?

data one;
  set panelproj;
  if year = 2004 then cpi = 188.9;
  if year = 2008 then cpi = 215.303;
  if year = 2012 then cpi = 229.594;
  if year = 2016 then cpi = 240.007;
  RINC = INC/(CPI/100);
  logRINC= log(RINC);
run;

Or if you want to make a new data set them make sure to read the right input dataset.

data two;
  set one;
  logRINC= log(RINC);
run;
khalillx
Fluorite | Level 6
No need to be condescending. I'm new to SAS and am looking for help. Please do not respond to any of my posts with that kind of attitude again or you will be reported. I figured it out before you even responded anyways. You're not all that because you know how to use SAS.
Tom
Super User Tom
Super User

I still have no idea what meant by a variable turning blue.   And your response does not really clarify it either.

If one of the answers was helpful mark it as the correct answer.

Or if you solved it on your own then post the solution and mark your own answer as the solution.

 

PS Note that there was nothing condescending in my original post. I gave my diagnosis of what I thought was your problem and two ways to solve it.

 

 

ballardw
Super User

@khalillx wrote:

Everything has worked well up until the point I tried to log my variable RINC. Then I get this error message: NOTE: Variable RINC is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
200 at 66:10
NOTE: There were 200 observations read from the data set WORK.PANELPROJ.
NOTE: The data set WORK.TWO has 200 observations and 9 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.01 seconds

 

Here's my full code. I hit my pathway.

 

ibname session1 "C:\x";

PROC IMPORT OUT = panelproj
DATAFILE = "C:\x"
DBMS=csv REPLACE;
run;

proc contents;
run;
proc print;
run;
data one;
set panelproj;
if year = 2004 then cpi = 188.9;
if year = 2008 then cpi = 215.303;
if year = 2012 then cpi = 229.594;
if year = 2016 then cpi = 240.007;
RINC = INC/(CPI/100);
run;

proc contents;
run;

proc print;
run;

 

proc means;
class year;
var RINC UR educ VT;
run;

 

data two;
set panelproj;
logRINC= log(RINC);
run;

 

proc print;
run;

 

My code when I try to log my variable is not turning blue which makes me think I'm writing the code wrong. This is the way I did it in SAS studio but it may be different for SAS 9.4. 


Foundation, Base or Display Manager, pick you choice for name, enhanced editor does not highlight function calls in general because most are not "keywords" like DATA, PROC or SET.

Kurt_Bremser
Super User

Look closely at this:

data two;
set panelproj;
logRINC= log(RINC);
run;

You created RINC in dataset one, not in dataset panelproj:

data one;
set panelproj;
if year = 2004 then cpi = 188.9;
if year = 2008 then cpi = 215.303;
if year = 2012 then cpi = 229.594;
if year = 2016 then cpi = 240.007;
RINC = INC/(CPI/100);
run;

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
  • 787 views
  • 0 likes
  • 5 in conversation