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 all SAS Users,

 

1. I get something wrong with my logic.

 

I have the variables cshtrd and prccd_abs_ are numeric variables, the summary is as below

My97_0-1614934161156.png

I want to generate a variables named dollar_vol= cshtrd*prccd_abs_

My code is

Comment trading volume*unadjusted price (converted to USD)< 100$ 
then set missing ;

if cshtrd*prccd_abs_ <100 and n(cshtrd,prccd_abs_)=2 then dollar_vol=.; else dollar_vol=cshtrd*prccd_abs_;

And the log says that ( I just post lines 37 and 39 because they are relevant to the NOTE)

37         		if cshtrd*prccd_abs_ <100 and n(cshtrd,prccd_abs_)=2
38         		then dollar_vol=.;
39         		else dollar_vol=cshtrd*prccd_abs_;

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).
      176040 at 37:12   176040 at 39:25 

I am wondering what I did wrong in my calculation and is there any hint to fix it?

 

Warm 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.
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

The log message:

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

and later it points to log line 37 where the code is:

if cshtrd*prccd_abs_  ....

means that either CSHTRD or PRCCD_ABS or both contain missing value, therefore the result is missing value.

You have to decide if you want to deal with this case in a different way and code your program appropriately. 

View solution in original post

2 REPLIES 2
Shmuel
Garnet | Level 18

The log message:

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

and later it points to log line 37 where the code is:

if cshtrd*prccd_abs_  ....

means that either CSHTRD or PRCCD_ABS or both contain missing value, therefore the result is missing value.

You have to decide if you want to deal with this case in a different way and code your program appropriately. 

Phil_NZ
Barite | Level 11

Thank you @Shmuel 

After changing to double if, the error note no longer exists, and after checking mean, the results from the old and new code are the same for variable dollar_vol

if n(cshtrd,prccd_abs_)=2 then if cshtrd*prccd_abs_ <100 /*chnaged line*/
		then dollar_vol=.;
		else dollar_vol=cshtrd*prccd_abs_;

Thank you!

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
  • 2 replies
  • 375 views
  • 1 like
  • 2 in conversation