Skip to content

Commit 4cae7c9

Browse files
committed
[XPT writer] Write row count in OBSV8 record
1 parent 0367470 commit 4cae7c9

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/sas/readstat_xport_write.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ static readstat_error_t xport_write_header_record_v8(readstat_writer_t *writer,
5353
xport_header_record_t *xrecord) {
5454
char record[RECORD_LEN+1];
5555
snprintf(record, sizeof(record),
56-
"HEADER RECORD*******%-8sHEADER RECORD!!!!!!!%-30d",
57-
xrecord->name, xrecord->num1);
56+
"HEADER RECORD*******%-8sHEADER RECORD!!!!!!!" "%15d" "%15d",
57+
xrecord->name, xrecord->num1, xrecord->num2);
5858
return xport_write_record(writer, record);
5959
}
6060

@@ -356,12 +356,16 @@ static readstat_error_t xport_write_namestr_header_record(readstat_writer_t *wri
356356
}
357357

358358
static readstat_error_t xport_write_obs_header_record(readstat_writer_t *writer) {
359+
if (writer->version == 8) {
360+
xport_header_record_t xrecord = {
361+
.name = "OBSV8",
362+
.num1 = writer->row_count
363+
};
364+
return xport_write_header_record_v8(writer, &xrecord);
365+
}
359366
xport_header_record_t xrecord = {
360367
.name = "OBS"
361368
};
362-
if (writer->version == 8) {
363-
strcpy(xrecord.name, "OBSV8");
364-
}
365369
return xport_write_header_record(writer, &xrecord);
366370
}
367371

0 commit comments

Comments
 (0)