6.1 Delimiters, headers and quoting
The control-stream dataset reader accepts comma-separated, tab-separated and whitespace-separated text. It detects the delimiter from up to the first 20 non-empty lines: comma wins when at least half contain a comma, then tab, otherwise whitespace.
Header detection
The first non-empty line is a header when its first field is not numeric and does not begin with #. Header names are uppercased for reporting; a leading @ or # is removed from each header label after the line has been recognised as the header. A header is useful for detecting misalignment, but when $INPUT is present it does not define the model's column names. Position does.
Standalone commands such as qc-data, eda and nca use their own header-oriented reader because they may have no control stream. Give those files ordinary headers such as ID,TIME,DV. A leading @ID can be appropriate to a NONMEM $DATA ... IGNORE=@ convention but should not be assumed portable to every standalone reader. The Chapter 6 BLQ fixture therefore uses ID while its control stream still contains IGNORE=@; a recognised header is skipped before record filtering.
Quoting is field-level, not a full CSV dialect
For comma and tab files, nlmx splits on the delimiter and trims spaces plus surrounding double quotes from each field. It does not implement embedded-delimiter CSV quoting. For example, "New York, NY" contains a comma that still divides fields. Character-valued columns must be dropped for the control-stream model reader; standalone exploration commands can retain text columns.
Whitespace files use runs of whitespace as separators. They cannot represent a text value containing spaces as one field merely by adding quotes, because splitting happens first. Prefer comma or tab for mixed numeric/text data and avoid embedded delimiters in text labels.
Blank lines are removed before control-stream parsing, but qc-data can report them as a file-quality issue. A formal exchange dataset should have one header followed by one physical record per line.
Comments and $DATA IGNORE
Comment-line behavior comes from $DATA, not from a universal rule that every line beginning with a symbol is ignored. IGNORE=@ commonly excludes marked rows. Conditional IGNORE and ACCEPT expressions are covered in Section 6.13.
The reader reports the source's one-based physical line number in data errors. Retain the original file unchanged so a message such as row 47 remains actionable.
Assumptions and limits
Delimiter detection assumes a consistent file. A comma-delimited header followed by whitespace data is not a supported mixed dialect. The parser is designed for NONMEM-style rectangular data, not arbitrary RFC-complete CSV.
Common mistakes
- Assuming the header renames a
$INPUTitem. - Putting commas inside quoted labels.
- Using text with spaces in a whitespace-delimited dataset.
- Assuming
@IDis accepted identically by every standalone command. - Cleaning blank lines before retaining the source that produced a line-numbered error.
Checklist
- One delimiter is used consistently.
- The first field makes header presence unambiguous.
- Text labels contain no unescaped delimiter.
- Standalone commands receive the column names they expect.
- The original physical file is retained for line-numbered diagnostics.
Further reading
Section 6.2 explains why $INPUT position is authoritative. Chapter 11 will cover the fuller file-format checks performed by qc-data.