Page 1 of 1

Stata to CSPro

Posted: October 15th, 2014, 10:47 am
by Stavros
Hi all,

I have a question for you; has anyone tried to create a lookup file from a Stata dataset?

To be more specific, I am taking part in survey where the data entry was done with CSPro, the data then were exported to Stata where the cleaning was done. Now for the follow-up of the survey some variables of the cleaned data are going to be used, mainly variables like Household Id, Name, Gender, Age etc. There is an option in Stata to export a dataset in a comma separated format (so I can use this as a Lookup File) but when I tried that the variables do not have a fixed length (as already set from CSPro) causing a big issue when it comes to creating the dictionary so it can match the lookup file. What I mean with fixed length, while in CSPro name variable is set to have 30 characters length, so even if a name has 10 characters it would be followed by 20 empty spaces and then the next variable would follow. In my case (exporting from Stata) this is not happening, a name with 10 characters or 6, does not follow the 30 char. length.

I hope that I managed to describe the issue I am facing and I am also pretty sure that this a Stata's fault so it maybe not the right forum to ask but maybe someone knows something!

Thanks in advance,
Stavros

Re: Stata to CSPro

Posted: October 16th, 2014, 5:56 am
by Stavros
Hi all,

I managed to find a solution for my issue. I imported the data in R and R has an option to export a csv file with fixed column width.

Best,
Stavros

Re: Stata to CSPro

Posted: October 16th, 2014, 8:30 pm
by Gregory Martin
I'm glad that you solved your problem. Also know that you can always create a CSPro file easily if you can get it to Excel format. Here are instructions:

http://www.csprousers.org/help/html/imp ... format.htm

I'm not sure if Stata has an Export to Excel option though.