Check if it falls in a certain range

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
Tsheringcee
Posts: 12
Joined: July 4th, 2017, 4:21 am

Check if it falls in a certain range

Post by Tsheringcee »

Is there an easier way to check if the variables has only the following codes and not any other. I have occupation code as follows 1201 1203 1204 1205 1301 1302 1307 1401 1403 1406 so on. So you see it's not continuous so I cannot use an edit to check if the variables only have the following values and nothing else. Is there a easier way to check because if I have to write individual values it will be too long I have about 690 occupation codes

Thank you
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Check if it falls in a certain range

Post by josh »

If you have your list of codes in Excel then you can copy and paste them into a value set in your dictionary. In Excel you need the first column to be the label and the second to be the code. Then copy the two columns in Excel and in the dictionary editor in CSPro click on the variable to bring up the value set and choose paste. CSPro automatically checks that a value is in the value set during data entry. You can also do the same check in logic using the invalueset() function.
Tsheringcee
Posts: 12
Joined: July 4th, 2017, 4:21 am

Re: Check if it falls in a certain range

Post by Tsheringcee »

Thanks josh but i forgot to put it in the entry program so I want to now check in the batch editing program. Can yiu give me an example of using the invaluset function


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

Re: Check if it falls in a certain range

Post by josh »

It is pretty straightforward to use. If you add the valueset to the variable in your dictionary then all you need to do is call invalueset(MYVARIABLE) in your logic. It returns 1 if the value of MYVARIABLE is in the value set and 0 if not. There are a couple of examples in the help:

http://www.csprousers.org/help/CSPro/in ... ction.html
Post Reply