diff --git a/scrunch/datasets.py b/scrunch/datasets.py index 49906de..1164f98 100644 --- a/scrunch/datasets.py +++ b/scrunch/datasets.py @@ -1703,9 +1703,12 @@ def create_variable(self, var_type, name, alias=None, description='', if categories: payload['categories'] = categories if subvariables: - payload['subreferences'] = [ - {'name': item['name']} for item in subvariables - ] + payload['subreferences'] = [] + for item in subvariables: + subrefs = {'name': item['name']} + if item.get('alias'): + subrefs['alias'] = item['alias'] + payload['subreferences'].append(subrefs) if values: payload['values'] = values