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

Discussions about CSEntry
Gillesbop
Posts: 11
Joined: August 11th, 2016, 3:22 am

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

Postby Gillesbop » August 17th, 2018, 7:18 am

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 !
Attachments
draft.rar
(1.98 MiB) Downloaded 17 times

josh
Posts: 1687
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

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

Postby josh » August 17th, 2018, 8:13 am

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.
Attachments
Census Data Entry (cascading value set).zip
(24.89 KiB) Downloaded 33 times

Gillesbop
Posts: 11
Joined: August 11th, 2016, 3:22 am

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

Postby Gillesbop » August 18th, 2018, 5:32 am

Thanks Josh ! It’s rather on chapter 6 that they talk about look up file. Thanks again !


Return to “Entry”