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

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

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

Post 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 !
You do not have the required permissions to view the files attached to this post.
josh
Posts: 2403
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

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

Post 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.
You do not have the required permissions to view the files attached to this post.
Gillesbop
Posts: 23
Joined: August 11th, 2016, 3:22 am

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

Post by Gillesbop »

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