Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Analyzing .lss-file to find variables with numeric range restriction

  • EnzmannD
  • EnzmannD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 days 1 hour ago #270763 by EnzmannD
Caveat: When reading (and hopefully answering) my question, please be patient with me if I can't us the appropriate "LimeSurvey language": I am not a LimeSurvey programmer but only a user who wants to make sense of data exported from a LimeSurvey questionnaire.

My problem refers to open answer questions (fields) of a LimeSurvey questionnaire. The input format of only some of these open answer questions is set to numeric and the numbers are restricted from 0 (min) to 999 (max), while the input of some other of these questions is numeric without a restriction of numbers, while the input format of still others is string (i.e. completely unrestricted). Note that the open answer questions are filtered, i.e. the open answer question is asked only if the respondent did answer a previous question with "yes".

I have the data of this questionnaire exported to SPSS (and then imported by Stata). If the variable of an open answer question contains nothing or text (not only numbers) the format is string, otherwise it is numeric. My problem: I want to know the LimeSurvey input format of these variables (and whether numeric input format was restricted to say 0 (min) and 999 (max). 

To get to know this can open the questionnaire in LimeSurvey, edit the respective question, and can look up the setting for the question type and the input (whether numeric or not and the range restriction). With many variables this is very cumbersome and I am looking for an alternative. Exporting the questionnaire as .pdf-file does not help because this does not show the question type and the range restriction of numeric fields.

I did export the questionnaire as .lss file. Here I can see the range restriction, for example
Code:
   <row>
    <qid><![CDATA[719174]]></qid>
    <attribute><![CDATA[max_num_value_n]]></attribute>
    <value><![CDATA[999]]></value>
    <language/>
   </row>
   <row>
    <qid><![CDATA[719174]]></qid>
    <attribute><![CDATA[min_num_value_n]]></attribute>
    <value><![CDATA[0]]></value>
    <language/>
   </row>
However, I don't know to which variable <![CDATA[719174]]> belongs -- I can search the .lss file for 719174 and try to guess, but this is extremely cumbersome and slow: Doing this I could determine that "CDATA[719174]" belongs to the the variable "vrobptother".

My question: Is there a better way to determine the input format if I know only the variable name (as in my example "vrobptother")? Are there any tools to analyze or display .lss files that allow me to search for "999" and determine the variable to which this maximum input format is applied?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 22 hours ago #270764 by Joffm
Hi,

With many variables this is very cumbersome 

Better you use the logic file of the survey. Here you see all you need.

I am looking for an alternative.

Investigating the lss file is obviously not an alternative.
Search in section <question_attributes> for restrictions, get the questionID (qid), then search in <questions> for the question title 
Or viceversa.

But I am a bit surprised.
Isn't there a final paper draft of the questionnaire with all conditions, filters, restrictions, and so on?
Usually this is the base to start creating the survey in LimeSurvey.

But I do not see your issue.
If there is a "numerical input" question that is entirely empty, it is still handled as "numeric" - and "missing" - in SPSS. 



As you see in the syntax file, it is "numeric"
 

Or was a question of type "short text" (mis)used to enter numbers?

Joffm

BTW: It's always advisable to provide a lss export.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • EnzmannD
  • EnzmannD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 22 hours ago #270765 by EnzmannD
When importing the originally SPSS data file (originally exported from LimeSurvey) in Stata I can make the properties of variables and values visible. Here screenshot 1 (attached as LS_screenshot_1.png) showing the properties of the LimeSurvey variable "vrobtpother" (in Stata later renamed to "vrobblyi"): It is numeric, but it does not show whether the LimeSurvey question (numeric open field) did restrict the values (in fact, they are restricted to the range 0--999):
 

In another data set imported from LimeSurvey the properties of the LimeSurvey variable "vrobbtp_other" (corresponding to "vrobtpother" in screenshot 1) (attached as LS_screenshot_2.png) is also numeric, but it has been string in LimeSurvey (i.e. with no range restrictions):
 

My problem: I am searching for a way to determine quickly (easily) the LimeSurvey open field questions (variables) where the input has been restricted (as in the first examples to values between 0 and 999).
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 days 21 hours ago - 4 days 21 hours ago #270766 by Joffm
Hi, that you get the variable name in SPSS is obvious.
You see in the syntax file the RENAME command at the end.
But that's not relevant.

I am searching for a way to determine quickly (easily) the LimeSurvey open field questions

I already wrote: "Survey logic file".
Then just search for (CTRL-F)  "num_value"

Or export the survey as *.txt, open in Excel (OpenOffice) and have a look at the columns "max_num_value_n" and "min_num_value_n"

But now I see that you did not talk about an open question, but probably about the "other" option of a single punch question.
Meaning: your first variable "vroptptpother" seems to be a "numeric" question,
but the other one "vroptbtp_other" seems to be an "other" option.
Therefore it is really advisable to send a lss export.

In a "numeric" question (restricted or not) I always get a numeric variable in SPSS.
I will check what happens if it is an "other" option.

1. I wonder where SPSS is to store this restriction?
2. Anyway; this is not contained in the syntax file.


And something nearly forgotten.
You did not answer the questions that appeared at the beginning. You removed them.
The least thing you'd mention is the LS version you are using.
 

And a last thing.
Why do you first export and import into SPSS to get the data in STATA?
Why don't directly export to STATA?

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 days 21 hours ago by Joffm.

Please Log in to join the conversation.

  • EnzmannD
  • EnzmannD's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 days 5 hours ago - 4 days 5 hours ago #270767 by EnzmannD

The least thing you'd mention is the LS version you are using.

LimeSurvey Community Edition Version 6.13.2

You did not answer the questions that appeared at the beginning. You removed them.

I don't know which questions you are referring to -- I am not aware of having removed any of your questions (perhaps by accident, I don't know how this would be possible).

Why do you first export and import into SPSS to get the data in STATA?
Why don't directly export to STATA?

This is a misunderstanding, I did export the questionnaire data from LimeSurvey into SPSS format, but I did not import the exported SPSS data (.sav) with SPSS. I did not directly export from LimeSurvey into a Stata format file (the only option is .xml, not .dta) because the last time I tried (with an older LimeSurvey version about 3 years ago) the resulting data in Stata were not in the form I need them (the exact problems I don't remember). As far as I know I tried all ways to export data from LimeSurvey (into Stata (.xml) directly, into CSV files, into Excel, into R (data file), and into SPSS (.sav) using different methods) but only one method resulted in satisfactory data with missing values, labels, and paradata, format of multiple response question, etc.

I am exporting the questionnaire data from LS into SPSS format via "Responses" -> "Export Responses" -> Export format SPSS, export language English, Range (first to last record), Full answers (convert Y to 1 and N to 2). The more direct way via "Responses" -> "Export responses to SPSS" does not export paradata (e.g. time at all pages) and results in unsatisfactory formatting of multipe reponse questions, missing values, and answers to "other" fields.

But now I see that you did not talk about an open question, but probably about the "other" option of a single punch question.
Meaning: your first variable "vroptptpother" seems to be a "numeric" question,
but the other one "vroptbtp_other" seems to be an "other" option.
Therefore it is really advisable to send a lss export.

I don't know what "a single punch question" is (I am not a LS expert and I did not program the LS questionnaire myself but simply try to do the data cleaning of data collected with LS qustionnaires). I notice that there are two kinds of open field questions, (1) as a follow-up question that seems to contain data sometimes in string and sometimes in numeric format (also depending on the way .sav data are imported by SPSS, PSPP, or Stata), and (2) as open field questions set up in LS in a different way (I don't know how this has been done). In variant (1) note that the values of the filtering question contains either the number 1 (if the respondent did choose "no" with empty content of the follow-up question) or the string "-oth-" if the respondent did choose "yes", whereas in variant (2) the filtering question contains the numbers 0 (if the respondent did choose "no") or 1 (if the respondent did choose "yes").

I don't know what you mean by "Therefore it is really advisable to send a lss export." Do you ask to send (attach) the .lss export file here (at my post to the forum)?

But the problem of exporting from LimeSurvey and importing to Stata (or the issues with different ways the data appear in Stata as a consequence of the method of exporting questionnaire data from LS) is not my issue here -- I am explaining this only because you asked.

I already wrote: "Survey logic file".
Then just search for (CTRL-F)  "num_value"

I don't know what a "Survey logic file" is -- how can I obtain this from LS?

You see in the syntax file the RENAME command at the end.

I don't know to what syntax file you are referring. I did to show you any syntax file and I don't get a (SPSS?) syntax file when exporting questionnaire data from LS.

Or export the survey as *.txt, open in Excel (OpenOffice) and have a look at the columns "max_num_value_n" and "min_num_value_n"

Thanks a lot, this solves it!
 
Last edit: 4 days 5 hours ago by EnzmannD. Reason: My last "reason for editing" was wrong: I did not import the exported file (.sav) with SPSS but directly with Stata!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 days 4 hours ago #270768 by Joffm
Hi,
I conducted a small test.
And I see no issue at all.
The SPSS export is as it is expected to be

1. A "numeric" question is still a numeric variable in SPSS, no matter of restrictions or not. (BTW: these restrictions only affect the data entry of the respondent) 
If the question is empty, there is a format of "F1.0"
If not, the format depends on the longest entry.

2. A question of type "text" is still a string vaiable in SPSS, no matter what you enter in LS, even if you force a numeric entry be "question validation equation".
If the question is empty, there is a format of "A1"
If not, the format depends on the longest entry.

Here a SPSS file of a survey with empty fields


and the same with filled fields
   



Survey Logic File:
 

Syntax file: So you seem to export directly to a *.sav file.
I personally prefer the export with syntax and data file.
Reason: You always have to adapt texts.
questions (and answer options )often contain some explanations for the respondent, or other things, that shouldn't be incliuded in the analysis and the final tabulation. And the synatx file is a good place to do this quite easily.
But it's only personal preference.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose