This is only possible after MDL-10899 is fixed. It introduces a new function question_move_questions_to_category($questionids, $newcategory) in questionlib.php, which currently has a comment // TODO Deal with datasets.
Datasets on calculated questions can either be private to this question, in which case question_dataset_definitions.category = 0, or they can be available for sharing between all questions in a category, in which case question_dataset_definitions.category points to question_categories.id.
This bug is about what to do with question_dataset_definitions.category when a question using that dataset is moved to another category. There are several cases for each dataset that is used by one of the questions we are moving:
1. if question_dataset_definitions.category == 0, do nothing.
2. if question_dataset_definitions.category != 0, but all the questions that use this particular dataset are in the list of questions being moved. In this case, just update question_dataset_definitions.category to point to the new category.
3. if question_dataset_definitions.category != 0, and there are questions that will remain in the old category that share this dataset with questions that are moving. This is the hard case.
In think in case 3. we should automatically create a copy of the dataset in the new category.
Does this sound like the right plan?