Page 1 of 1

Value set name and value label from External file (Excel)

Posted: August 17th, 2018, 7:18 am
by Gillesbop
Hello Everyone!

Please, by the way, I have an Excel file that I would like to read with CSPro it is the data of the administrative division of my country in the attached excel file.

So I would like to make sure that when I choose a region, CSPro only displays the departments, subprefectures and villages of this region.

I know how to do this manually on CSPro with the function "setvalueset (variable_name, Value_set_name)", but this time the data is in a rather large Excel file and I think it's quite difficult to do it manually.

I will be very grateful to you forhelping me.

Thanks !

Re: Value set name and value label from External file (Excel)

Posted: August 17th, 2018, 8:13 am
by josh
You can do this using a lookup file. Use the Excel2CSpro tool to generate a dictionary and data file from your spreadsheet. Then you can use loadcase to lookup the subprefectures for the chosen department and make a value set from them using the version of setvalueset that takes an array of codes and an array of labels.

See chapter 5 in this document: http://www.csprousers.org/resources/CSP ... rkshop.pdf for a more detailed explanation. You can download the working example from here: http://www.csprousers.org/resources/CSP ... erials.zip

A more complex example that handle multiple levels of geography is attached to this post.

Re: Value set name and value label from External file (Excel)

Posted: August 18th, 2018, 5:32 am
by Gillesbop
Thanks Josh ! It’s rather on chapter 6 that they talk about look up file. Thanks again !