0
$\begingroup$

I'm having a little fun and I'd love to know how to write a SQL or dwSQL query across these two datasets of Trumps tweets and Facebook posts. Here are the datasets:

Trump Facebook Posts https://data.world/dave/trumps-facebook-statuses

Trump Tweets https://data.world/dave/trump-tweets

Ideally I would like to be able to count the distinct instances that a word or phrase (like 'crooked' or 'massive' or 'the best' appeared across both datasets.

The table name for the Facebook Post dataset is TrumpFacebook and for the Trump Tweets is trump_tweets.

$\endgroup$
2
  • 1
    $\begingroup$ what kind of things have you tried so far? $\endgroup$ Commented Oct 21, 2016 at 15:49
  • $\begingroup$ Please add what you tried and which DB you are using for SQL since some syntax is different per DB. $\endgroup$
    – Stereo
    Commented Oct 22, 2016 at 16:48

1 Answer 1

1
$\begingroup$

Have you tried something like this in SAS?

PROC SQL;
 CREATE TABLE TRUMP_FB_TWEETS AS
 SELECT *
 FROM TRUMP_FB
 UNION CORRESPONDING ALL
 SELECT *
 FROM TRUMP_TWEETS;
QUIT;

Source:http://www2.sas.com/proceedings/sugi25/25/cc/25p109.pdf

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to the Data science SO, the opp is asking for a SQL solution not SAS. Very few people have access to SAS so I would recommend to phrase this as a general SQL solution. $\endgroup$
    – Stereo
    Commented Oct 22, 2016 at 16:45
  • $\begingroup$ SAS University is a free download, but I can see your point. $\endgroup$
    – AbbyPaden
    Commented Oct 23, 2016 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.