Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

How to use .cho file in R or Stata

I am wondering how to run my ACBC data in either R or Stata for additional analysis. I understand how to save the data as a .cho, but my difficulty is in what coding I should use to instruct R or Stata on how to import this and make it useable. Does anyone have a script/ .do file or any advice on how to go about doing this?
asked Apr 18, 2017 by Nathaniel Burke (170 points)

1 Answer

+1 vote
Best answer
We don't have any scripts to handle that. For the most part I've tried very hard to avoid the need to do so since .cho files aren't particularly nice to work with, but ACBC has some things that don't translate fully into the .csv formats.

The best advice I can give is to just meticulously follow the documentation as to their structure (see https://www.sawtoothsoftware.com/download/ssiweb/CBCHB_Manual.pdf Appendix C).

You'll need a script that reads the file line by line, and if you parse and interpret it correctly, you should be able to avoid any guesswork as to what you're reading.  For example Line 1 will tell you how many questions that respondent will have, and Line 2 will be the first question and tell you how many response options to expect in the next coming lines. As soon as the lines for one thing are finished, you can safely read for the next thing.

General script for parsing an R file line by line.

For splitting a line into pieces and converting it to a vector: https://stat.ethz.ch/R-manual/R-devel/library/base/html/strsplit.html

Between those two things, you should be able to get things into a readable R format. Hopefully that leads in a helpful direction.
answered Apr 18, 2017 by Kenneth Fairchild Bronze Sawtooth Software, Inc. (3,520 points)
selected Apr 18, 2017 by Nathaniel Burke
Thank you, I think I will be able to piece together a workable script with this information.