I want to assign deciles for tweets within each publishday. How can I do it?
Below is my code:
proc sort data=abc.twitter;
by publishday tweets;
run;
data try2;
set abc.twitter;
keep publishday tweets;
run;
proc rank data=try2 groups=10 out=try2;
var tweets;
ranks decile;
run;
The result I get is only 8 ranks instead of 10 ranks each day. I use proc freq to check out the number of ranks within each day. But only 1,3,4,5,6,7,8,9 are shown, and rank 0 and rank 2 are missing.
proc freq data=try;
table decile;
by publishday;
run;
Thank you.
No. I just checked. I have unique firm-date data for tweets for a firm on a day. Now, it becomes only 8 ranks after I rerun the same codes. Really don't know why the results are inconsistent.
@Jarvin99 wrote:
No. I just checked. I have unique firm-date data for tweets for a firm on a day. Now, it becomes only 8 ranks after I rerun the same codes. Really don't know why the results are inconsistent.
The duplicates you need to check for are in the number of tweets, not in the unique publishday
Another possibility why you are getting only 8 ranks is because there is only 8 data points for a unique publishday
Aren't tweets text data? How are deciles being calculated for that? Or should it be based on time of day for the tweets?
You have your deciles on the variable tweets. You're saying the variable tweets doesn't have any duplicates? So no retweets in the data?
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: