Page 1 of 1

flatten alpha

Posted: April 30th, 2020, 2:51 am
by etuser
Dear All,

When i flatten occurrence of a checkbox filed created during data collection to capture multiple responses questions and changed to Num from Alpha in the dictionary during batch editing , it was working in the previous version of Cspro's but the new beta version 7.4 of Cspro display an error message

The following items will be changed from alpha to numeric:
Existing alpha values in these items will no longer be readable
CQ62_11
CQ62_12
CQ62_13
CQ62_14

why is that ?

Re: flatten alpha

Posted: April 30th, 2020, 7:32 am
by josh
In CSPro 7.4 the csdb stores data differently than in CSPro 7.3. Each variable is stored in it's own column in the database rather than storing all values together as one one large text field. Since the database columns have a type - numeric or alpha - when you change the type of a column the data may no longer be readable. In this case, if the values in those variables consist of only numeric digits then they should still be read correctly. However, in the more general case where you switch an alpha item to become numeric, the system does not know that you have only numeric digits in those items.

So I would first make a copy of your data file to be safe and then you can ignore that message and it should correctly convert the items to numeric if they contain only numeric digits.

For more info on the new format see https://www.csprousers.org/help/CSPro/c ... ormat.html

Re: flatten alpha

Posted: April 30th, 2020, 11:01 am
by josh
Also since the new format is not based on the start positions on of items in the dictionary, when you flatten the occurrences you are introducing new variables that are not aligned to the old data. These new variables will be blank.

To flatten and keep the old values you could first convert the data file from csdb to text, then flatten and change to numeric and then convert back to csdb.

Alternatively rather than flatten the existing occurrences, introduce new variables and write a batch edit program that assigns from the variable with occurrences to the new variables. You can see an example of that in chapter 10 of the workshop materials: https://www.csprousers.org/resources/CS ... rkshop.pdf

Re: flatten alpha

Posted: May 1st, 2020, 6:44 am
by etuser
Thanks Josh, If I want to collect a multiple response question in Cspro 7.4 and if there is no direct way to flatten occurrence of a checkbox then Is there any other easy option to capture multiple response questions and also exporting the data to SPSS or STATA ?.

Re: flatten alpha

Posted: May 1st, 2020, 6:53 am
by josh
There are two ways as I mentioned in the answer above:

1) Convert to text, flatten, convert back

2) Instead of flatten, add additional variables and use logic to copy as we do in the workshop materials

Re: flatten alpha

Posted: May 1st, 2020, 12:18 pm
by etuser
Many Thanks Josh, I thought there might be a simpler way .