Merging variables from two separate files

Moderators: statman, Analyst Techy, andris, Fierce, GerineL, Smash

Posts: 1
Joined: Thu Jan 05, 2012 5:35 pm

Merging variables from two separate files

Postby Jeroen_Univoftwente » Thu Jan 05, 2012 5:49 pm


I'd like to ask you guys a question. I'm studying the behaviour and activities of polticians on social media like Twitter and Facebook. I've created two different datasets.

Dataset 1: variables --> day, medium (Twitter, Facebook etc), source (politician or party), subject (nature, military etc.).
This dataset contains all messages posted by political parties or politician on the different social media network. It consists of more than 2500 cases.

Dataset 2: variables --> day, source (politician or party), Twitter, Facebook, Hyves, LinkedIn.
This dataset consist of the amount of followers, friends, 'vrienden' and connections of the political parties and politicians at that day.

Both datasets have days ranging from day 1 until day 31.

My question is:
I'd like to add a variable to the first dataset called 'amount of readers'. This information is available in the second dataset. So if in dataset 1 a random case is: "day 4, Twitter, Mark Rutte, Finances", a fifth variable should be added which copies the value of the exact day and source from the second dataset. So if in the second dataset the case is "day 4, Mark Rutte, Twitterfollowers: 5000", the value of 5000 should be copied to a new variable 'amount of readers' in the first dataset.

Anyone an idea how to do this with a syntax file? Thousand times thank you in advance!!

Jeroen Wichers
Posts: 119
Joined: Wed May 25, 2011 7:07 am

Re: Merging variables from two separate files

Postby JonPedersen » Tue Jan 10, 2012 10:37 am

this is simple to do with match with day and name as match variables. However, to help you with exact code one would have to know exactly how the data are laid out. From your example it seems like one might have to parse the follower field before or after merging.

Who is online

Users browsing this forum: No registered users and 2 guests