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

Hi @qoit 

It works, finally. Just one more cocern.

 

So based on this code

 %if &&bdate_type&i.=C %then
%do;
if length(&var2del)=5 and upcase(&var2del) ne 'NA' then
SASDATE = input(&var2del,32.)+'30DEC1899'd;
else SASDATE= input(&var2del,anydtdte32.);
%end;

it means that if &&bdate_type&i.=C and upcase(&var2del) = 'NA', the code

SASDATE= input(&var2del,anydtdte32.)

will generate a missing observation and the log will perform

Missing values were generated as a result of performing an operation on missing values.

when you process 

		format SASDATE yymmdd10.;

		if not missing(sasdate) and year(SASDATE) ne 2021 then
			fir_age = log(1+(2020-year(SASDATE)));

Am I correct?

I just want to make sure that such a log is not an error in this situation.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
qoit
Pyrite | Level 9
It is not an error. The character variable BDATE which you are trying to convert to numeric has missing values. This should suppress it :
input(&var2del,?? anydtdte32.)
Phil_NZ
Barite | Level 11

Hi @qoit 

 

Thank you for your prompt reply.

I did change as you suggest, but it still exit the note "Missing values were generated as a result of performing an operation on missing values."

 

I mean, the character variable BDATE does not have missing values, it is just because the code 

SASDATE= input(&var2del,anydtdte32.)

will force the BDATE which has value "NA" will receive the "."

And then, the code 

		format SASDATE yymmdd10.;

		if not missing(sasdate) and year(SASDATE) ne 2021 then
			fir_age = log(1+(2020-year(SASDATE)));

will cause the note" Missing values were generated as a result of performing an operation on missing values."

 

It is my explanation, does it make sense or I am in another fallacy?

 

Warmest regards.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.
qoit
Pyrite | Level 9
My apologies, it does make complete sense. Yes, I did notice the NA values. Since the NA can't be converted to numeric values, SAS leaves a note in the log that such values will just be assigned a "." (missing numeric value).
And, yes, ?? will not work as it is to suppress warning and errors. ?? will reset the _ERROR_ variable to 0.
Phil_NZ
Barite | Level 11

Hi @qoit 

 

Thank you for such an interesting discussion! I get it now.

 

Many thanks and have a good day.

Thank you for your help, have a fabulous and productive day! I am a novice today, but someday when I accumulate enough knowledge, I can help others in my capacity.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 1126 views
  • 10 likes
  • 3 in conversation