General SAS data management question
Posted: 16 May 2012 12:59 PM   [ Ignore ]
Newbie
Rank
Total Posts:  5
Joined  2012-05-03

I do not know if I am allowed to post a question here, but I have a following problem in SAS:

data ADSK;
set ADSK;
if price < midpoint then tradedir1 = -1;
else if price > midpoint then tradedir1 = 1;
else tradedir1 = 0;
run;


but still tradedir1 is NOT zero for some cases when Price=Midpoint.. I have run out of ideas of why should that be happening.. What am I doing wrong? Do you have any ideas on that?
I also tried, does not help either!

data ADSK;
set ADSK;
if price < midpoint then tradedir1 = -1;
else if price > midpoint then tradedir1 = 1;
else if price = midpoint then tradedir1 = 0;
run;

Thank you..

 

Profile
 
 
Posted: 16 May 2012 06:57 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  901
Joined  2011-09-19

hi Npap,

It is puzzling; the code seems fine to me. I would like to give it a try with a sample dataset though.
Could you please edit your post and upload a zipfile containing a few records?

Maybe this will give a clue as to what is going on:

data temp;
set ADSK;
if price eq midpoint;
run;

data temp2;
set ADSK;
if price ne midpoint;
run;

temp should only hold rows where price equals midpoint, while temp2 should have rows where they differ.

thanks,

Joost

 Signature 

To reply/post new questions: Please use the group WRDS/SAS on Google Groups! http://groups.google.com/d/forum/wrdssas

Profile