Skip to content

Develop a function to split text exceeding 200 characters #19

Description

@parikp06

Feature Idea

Purpose

Split text exceeding 200 characters into multiple variables.
SDTMIG v3.3 | CDISC

Functionality

Based on the current requirement for the SAS v5 Transport file format, it is not possible to store the long text strings exceeding 200 characters using only one variable. Therefore, the SDTMIG has defined conventions for storing long text string using multiple variables. Follow the steps mentioned below to create a function to split long text into multiple variables.

  1. Split the first 200 characters of text into split_var1 and each additional 200 characters of text into split_varN

  2. When splitting a text string into several variables, the text should be split between words to improve readability, so it does not break a word.

  3. Create a variable split_count to hold the number of new variables created by the split.

  4. Default length to split on would be 200. However, please allow this value can be passed via split_length parameter to any other length.

Relevant Input

A character variable to be split into multiple variables.

An integer parameter split_length which would be set to 200 by default.

Relevant Output

One or more variables after splitting: split_var1 – split_varN.

Variable to hold the number of splits: split_count

Reproducible Example/Pseudo Code

split_vars(var_to_split,split_length=200)

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status
Sprint Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions